本文整理汇总了PHP中PHPUnit_Util_Printer::write方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Printer::write方法的具体用法?PHP PHPUnit_Util_Printer::write怎么用?PHP PHPUnit_Util_Printer::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_Printer
的用法示例。
在下文中一共展示了PHPUnit_Util_Printer::write方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printConsole
protected function printConsole(\PHPUnit_Util_Printer $printer)
{
$writer = new \PHP_CodeCoverage_Report_Text(
$this->settings['low_limit'], $this->settings['high_limit'], $this->settings['show_uncovered'], false
);
$printer->write($writer->process(self::$coverage, $this->options['colors']));
}
示例2: write
/**
* @param string $buffer
*/
public function write($buffer)
{
array_walk_recursive($buffer, function (&$input) {
if (is_string($input)) {
$input = PHPUnit_Util_String::convertToUtf8($input);
}
});
$flags = 0;
if (defined('JSON_PRETTY_PRINT')) {
$flags |= JSON_PRETTY_PRINT;
}
parent::write(json_encode($buffer, $flags));
}
示例3: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($arguments);
$this->processSuiteFilters($suite, $arguments);
if (isset($arguments['bootstrap'])) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
}
if ($arguments['backupGlobals'] === false) {
$suite->setBackupGlobals(false);
}
if ($arguments['backupStaticAttributes'] === true) {
$suite->setBackupStaticAttributes(true);
}
if ($arguments['disallowChangesToGlobalState'] === true) {
$suite->setDisallowChangesToGlobalState(true);
}
if (is_integer($arguments['repeat'])) {
$test = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['processIsolation']);
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest($test);
}
$result = $this->createTestResult();
if (!$arguments['convertErrorsToExceptions']) {
$result->convertErrorsToExceptions(false);
}
if (!$arguments['convertNoticesToExceptions']) {
PHPUnit_Framework_Error_Notice::$enabled = false;
}
if (!$arguments['convertWarningsToExceptions']) {
PHPUnit_Framework_Error_Warning::$enabled = false;
}
if ($arguments['stopOnError']) {
$result->stopOnError(true);
}
if ($arguments['stopOnFailure']) {
$result->stopOnFailure(true);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(true);
}
if ($arguments['stopOnRisky']) {
$result->stopOnRisky(true);
}
if ($arguments['stopOnSkipped']) {
$result->stopOnSkipped(true);
}
if ($this->printer === null) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$printerClass = 'PHPUnit_TextUI_ResultPrinter';
if (isset($arguments['printer']) && is_string($arguments['printer']) && class_exists($arguments['printer'], false)) {
$class = new ReflectionClass($arguments['printer']);
if ($class->isSubclassOf('PHPUnit_TextUI_ResultPrinter')) {
$printerClass = $arguments['printer'];
}
}
$this->printer = new $printerClass(isset($arguments['stderr']) ? 'php://stderr' : null, $arguments['verbose'], $arguments['colors'], $arguments['debug'], $arguments['columns']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n");
self::$versionStringPrinted = true;
if ($arguments['verbose']) {
$this->printer->write(sprintf("\nRuntime:\t%s", $this->runtime->getNameWithVersion()));
if ($this->runtime->hasXdebug()) {
$this->printer->write(sprintf(" with Xdebug %s", phpversion('xdebug')));
}
if (isset($arguments['configuration'])) {
$this->printer->write(sprintf("\nConfiguration:\t%s", $arguments['configuration']->getFilename()));
}
$this->printer->write("\n");
}
if (isset($arguments['deprecatedStrictModeOption'])) {
print "Warning:\tDeprecated option \"--strict\" used\n";
} elseif (isset($arguments['deprecatedStrictModeSetting'])) {
print "Warning:\tDeprecated configuration setting \"strict\" used\n";
}
if (isset($arguments['deprecatedSeleniumConfiguration'])) {
print "Warning:\tDeprecated configuration setting \"selenium\" used\n";
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if (isset($arguments['testdoxHTMLFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
$codeCoverageReports = 0;
if (isset($arguments['coverageClover'])) {
$codeCoverageReports++;
//.........这里部分代码省略.........
示例4: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @param bool $exit
*
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = [], $exit)
{
if (isset($arguments['configuration'])) {
$GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration'];
}
$this->handleConfiguration($arguments);
$this->processSuiteFilters($suite, $arguments);
if (isset($arguments['bootstrap'])) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
}
if ($arguments['backupGlobals'] === false) {
$suite->setBackupGlobals(false);
}
if ($arguments['backupStaticAttributes'] === true) {
$suite->setBackupStaticAttributes(true);
}
if ($arguments['beStrictAboutChangesToGlobalState'] === true) {
$suite->setbeStrictAboutChangesToGlobalState(true);
}
if (is_integer($arguments['repeat'])) {
$test = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['processIsolation']);
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest($test);
}
$result = $this->createTestResult();
if (!$arguments['convertErrorsToExceptions']) {
$result->convertErrorsToExceptions(false);
}
if (!$arguments['convertNoticesToExceptions']) {
PHPUnit_Framework_Error_Notice::$enabled = false;
}
if (!$arguments['convertWarningsToExceptions']) {
PHPUnit_Framework_Error_Warning::$enabled = false;
}
if ($arguments['stopOnError']) {
$result->stopOnError(true);
}
if ($arguments['stopOnFailure']) {
$result->stopOnFailure(true);
}
if ($arguments['stopOnWarning']) {
$result->stopOnWarning(true);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(true);
}
if ($arguments['stopOnRisky']) {
$result->stopOnRisky(true);
}
if ($arguments['stopOnSkipped']) {
$result->stopOnSkipped(true);
}
if ($this->printer === null) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$printerClass = 'PHPUnit_TextUI_ResultPrinter';
if (isset($arguments['printer']) && is_string($arguments['printer']) && class_exists($arguments['printer'], false)) {
$class = new ReflectionClass($arguments['printer']);
if ($class->isSubclassOf('PHPUnit_TextUI_ResultPrinter')) {
$printerClass = $arguments['printer'];
}
}
$this->printer = new $printerClass(isset($arguments['stderr']) ? 'php://stderr' : null, $arguments['verbose'], $arguments['colors'], $arguments['debug'], $arguments['columns'], $arguments['reverseList']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n");
self::$versionStringPrinted = true;
if ($arguments['verbose']) {
$runtime = $this->runtime->getNameWithVersion();
if ($this->runtime->hasXdebug()) {
$runtime .= sprintf(' with Xdebug %s', phpversion('xdebug'));
}
$this->writeMessage('Runtime', $runtime);
if (isset($arguments['configuration'])) {
$this->writeMessage('Configuration', $arguments['configuration']->getFilename());
}
}
if (isset($arguments['deprecatedCheckForUnintentionallyCoveredCodeSettingUsed'])) {
print "Warning: Deprecated configuration setting \"checkForUnintentionallyCoveredCode\" used\n";
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if (isset($arguments['testdoxHTMLFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
//.........这里部分代码省略.........
示例5: write
/**
* @param string $buffer
*/
public function write($buffer)
{
parent::write(json_encode($buffer));
}
示例6: write
/**
* @param string $buffer
*/
public function write($buffer)
{
array_walk_recursive($buffer, function (&$input) {
if (is_string($input)) {
$input = PHPUnit_Util_String::convertToUtf8($input);
}
});
parent::write(json_encode($buffer, JSON_PRETTY_PRINT));
}
示例7: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($arguments);
if (isset($arguments['bootstrap'])) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
}
if ($arguments['backupGlobals'] === FALSE) {
$suite->setBackupGlobals(FALSE);
}
if ($arguments['backupStaticAttributes'] === TRUE) {
$suite->setBackupStaticAttributes(TRUE);
}
if (is_integer($arguments['repeat'])) {
$test = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest($test);
}
$result = $this->createTestResult();
if (!$arguments['convertErrorsToExceptions']) {
$result->convertErrorsToExceptions(FALSE);
}
if (!$arguments['convertNoticesToExceptions']) {
PHPUnit_Framework_Error_Notice::$enabled = FALSE;
}
if (!$arguments['convertWarningsToExceptions']) {
PHPUnit_Framework_Error_Warning::$enabled = FALSE;
}
if ($arguments['stopOnError']) {
$result->stopOnError(TRUE);
}
if ($arguments['stopOnFailure']) {
$result->stopOnFailure(TRUE);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(TRUE);
}
if ($arguments['stopOnSkipped']) {
$result->stopOnSkipped(TRUE);
}
if ($this->printer === NULL) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$this->printer = new PHPUnit_TextUI_ResultPrinter(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP && !self::$versionStringPrinted) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
if (isset($arguments['configuration'])) {
$this->printer->write(sprintf("Configuration read from %s\n\n", $arguments['configuration']->getFilename()));
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
$result->addListener(new PHPUnit_Util_DeprecatedFeature_Logger());
}
if (isset($arguments['testdoxHTMLFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
$codeCoverageReports = 0;
if (extension_loaded('xdebug')) {
if (isset($arguments['coverageClover'])) {
$codeCoverageReports++;
}
if (isset($arguments['reportDirectory'])) {
$codeCoverageReports++;
}
if (isset($arguments['coveragePHP'])) {
$codeCoverageReports++;
}
if (isset($arguments['coverageText'])) {
$codeCoverageReports++;
}
}
if ($codeCoverageReports > 0) {
$codeCoverage = new PHP_CodeCoverage(NULL, $this->codeCoverageFilter);
$codeCoverage->setAddUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
$codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['processUncoveredFilesFromWhitelist']);
if (isset($arguments['forceCoversAnnotation'])) {
$codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
}
if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
$codeCoverage->setMapTestClassNameToCoveredClassName($arguments['mapTestClassNameToCoveredClassName']);
}
$result->setCodeCoverage($codeCoverage);
}
if ($codeCoverageReports > 1) {
if (isset($arguments['cacheTokens'])) {
$codeCoverage->setCacheTokens($arguments['cacheTokens']);
//.........这里部分代码省略.........
示例8: write
/**
* @param string $buffer
*/
public function write($buffer)
{
parent::write(json_encode($buffer, JSON_PRETTY_PRINT));
}
示例9: write
/**
* @param string $buffer
*/
public function write($buffer)
{
if (defined('JSON_PRETTY_PRINT')) {
parent::write(json_encode($buffer, JSON_PRETTY_PRINT));
} else {
parent::write(json_encode($buffer));
}
}