当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_TextUI_ResultPrinter::write方法代码示例

本文整理汇总了PHP中PHPUnit_TextUI_ResultPrinter::write方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_TextUI_ResultPrinter::write方法的具体用法?PHP PHPUnit_TextUI_ResultPrinter::write怎么用?PHP PHPUnit_TextUI_ResultPrinter::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_TextUI_ResultPrinter的用法示例。


在下文中一共展示了PHPUnit_TextUI_ResultPrinter::write方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startTestSuite

 public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
 {
     if ($this->maxLength == 0) {
         $iterator = new RecursiveIteratorIterator(new PHPUnit_Util_TestSuiteIterator($suite), RecursiveIteratorIterator::SELF_FIRST);
         foreach ($iterator as $item) {
             if ($item instanceof PHPUnit_Framework_TestSuite) {
                 $name = $item->getName();
                 if ($name == '') {
                     $name = '[No name given]';
                 } else {
                     $name = explode('::', $name);
                     $name = array_pop($name);
                 }
                 $this->maxLength = max($this->maxLength, strlen($name));
                 $item->setName($name);
             }
         }
     }
     if ($this->depth > 0) {
         parent::write("\n");
     }
     if ($this->depth == 1) {
         parent::write("\n");
     }
     parent::write(str_pad(str_repeat('  ', $this->depth++) . $suite->getName() . ': ', 40, ' ', STR_PAD_RIGHT));
 }
开发者ID:naderman,项目名称:ezc-unit-test,代码行数:26,代码来源:printer.php

示例2: write

 public function write($buffer)
 {
     if ($this->capture) {
         $this->buffer .= $buffer;
     } else {
         parent::write($buffer);
     }
 }
开发者ID:iakio,项目名称:phpunit-growlprinter,代码行数:8,代码来源:GrowlPrinter.php

示例3: write

 /**
  * @param string $buffer
  * @since  Method available since Release 3.1.0
  */
 protected function write($buffer)
 {
     if (PHP_SAPI != 'cli') {
         $buffer = htmlspecialchars($buffer);
     }
     if ($this->printer !== null) {
         $this->printer->write($buffer);
     } else {
         print $buffer;
     }
 }
开发者ID:mubassirhayat,项目名称:Laravel51-starter,代码行数:15,代码来源:TestRunner.php

示例4: 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'])) {
         $bootstrap = PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
         if ($bootstrap) {
             $GLOBALS['__PHPUNIT_BOOTSTRAP'] = $bootstrap;
         }
     }
     if ($arguments['backupGlobals'] === FALSE) {
         $suite->setBackupGlobals(FALSE);
     }
     if ($arguments['backupStaticAttributes'] === FALSE) {
         $suite->setBackupStaticAttributes(FALSE);
     }
     $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['stopOnFailure']) {
         $result->stopOnFailure(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");
     }
     foreach ($arguments['listeners'] as $listener) {
         $result->addListener($listener);
     }
     $result->addListener($this->printer);
     if (isset($arguments['storyHTMLFile'])) {
         require_once 'PHPUnit/Extensions/Story/ResultPrinter/HTML.php';
         $result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_HTML($arguments['storyHTMLFile']));
     }
     if (isset($arguments['storyTextFile'])) {
         require_once 'PHPUnit/Extensions/Story/ResultPrinter/Text.php';
         $result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_Text($arguments['storyTextFile']));
     }
     if (isset($arguments['testdoxHTMLFile'])) {
         require_once 'PHPUnit/Util/TestDox/ResultPrinter/HTML.php';
         $result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
     }
     if (isset($arguments['testdoxTextFile'])) {
         require_once 'PHPUnit/Util/TestDox/ResultPrinter/Text.php';
         $result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
     }
     if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory'])) && extension_loaded('xdebug')) {
         $result->collectCodeCoverageInformation(TRUE);
     }
     if (isset($arguments['logDbus'])) {
         require_once 'PHPUnit/Util/Log/DBUS.php';
         $result->addListener(new PHPUnit_Util_Log_DBUS());
     }
     if (isset($arguments['jsonLogfile'])) {
         require_once 'PHPUnit/Util/Log/JSON.php';
         $result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
     }
     if (isset($arguments['tapLogfile'])) {
         require_once 'PHPUnit/Util/Log/TAP.php';
         $result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
     }
     if (isset($arguments['junitLogfile'])) {
         require_once 'PHPUnit/Util/Log/JUnit.php';
         $result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     unset($suite);
     $result->flushListeners();
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $this->printer->printResult($result);
     }
     if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
         if (isset($arguments['coverageClover'])) {
             $this->printer->write("\nWriting code coverage data to XML file, this may take " . 'a moment.');
             require_once 'PHP/CodeCoverage/Report/Clover.php';
             $writer = new PHP_CodeCoverage_Report_Clover();
             $writer->process($result->getCodeCoverage(), $arguments['coverageClover']);
             $this->printer->write("\n");
             unset($writer);
         }
         if (isset($arguments['reportDirectory'])) {
             $this->printer->write("\nGenerating code coverage report, this may take a moment.");
             $title = '';
//.........这里部分代码省略.........
开发者ID:sethcasana,项目名称:phpunit,代码行数:101,代码来源:TestRunner.php

示例5: 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'])) {
         $suite = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     }
     $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']));
     }
     if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory']) || isset($arguments['coveragePHP']) || isset($arguments['coverageText'])) && extension_loaded('xdebug')) {
         $codeCoverage = new PHP_CodeCoverage(NULL, $this->codeCoverageFilter);
         $codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
         if (isset($arguments['cacheTokens'])) {
             $codeCoverage->setCacheTokens($arguments['cacheTokens']);
         }
         if (isset($arguments['forceCoversAnnotation'])) {
             $codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
         }
         if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
             $codeCoverage->setMapTestClassNameToCoveredClassName($arguments['mapTestClassNameToCoveredClassName']);
         }
         $result->setCodeCoverage($codeCoverage);
     }
     if (isset($arguments['jsonLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
     }
     if (isset($arguments['tapLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
     }
     if (isset($arguments['junitLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
     }
     if ($arguments['strict']) {
         $result->strictMode(TRUE);
         $result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']);
         $result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']);
         $result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     unset($suite);
     $result->flushListeners();
//.........这里部分代码省略.........
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:101,代码来源:TestRunner.php

示例6: 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'])) {
         require_once $arguments['bootstrap'];
     }
     if (is_integer($arguments['repeat'])) {
         $suite = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups']);
     }
     $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['stopOnFailure']) {
         $result->stopOnFailure(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['ansi']);
         }
     }
     $this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
     foreach ($arguments['listeners'] as $listener) {
         $result->addListener($listener);
     }
     $result->addListener($this->printer);
     if (isset($arguments['storyHTMLFile'])) {
         require_once 'PHPUnit/Extensions/Story/ResultPrinter/HTML.php';
         $result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_HTML($arguments['storyHTMLFile']));
     }
     if (isset($arguments['storyTextFile'])) {
         require_once 'PHPUnit/Extensions/Story/ResultPrinter/Text.php';
         $result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_Text($arguments['storyTextFile']));
     }
     if (isset($arguments['testdoxHTMLFile'])) {
         require_once 'PHPUnit/Util/TestDox/ResultPrinter/HTML.php';
         $result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
     }
     if (isset($arguments['testdoxTextFile'])) {
         require_once 'PHPUnit/Util/TestDox/ResultPrinter/Text.php';
         $result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
     }
     if (isset($arguments['graphvizLogfile'])) {
         if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
             require_once 'PHPUnit/Util/Log/GraphViz.php';
             $result->addListener(new PHPUnit_Util_Log_GraphViz($arguments['graphvizLogfile']));
         }
     }
     if ((isset($arguments['coverageClover']) || isset($arguments['coverageSource']) || isset($arguments['metricsXML']) || isset($arguments['pmdXML']) || isset($arguments['reportDirectory'])) && extension_loaded('xdebug')) {
         $result->collectCodeCoverageInformation(TRUE);
     }
     if (isset($arguments['jsonLogfile'])) {
         require_once 'PHPUnit/Util/Log/JSON.php';
         $result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
     }
     if (isset($arguments['tapLogfile'])) {
         require_once 'PHPUnit/Util/Log/TAP.php';
         $result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
     }
     if (isset($arguments['xmlLogfile'])) {
         require_once 'PHPUnit/Util/Log/XML.php';
         $result->addListener(new PHPUnit_Util_Log_XML($arguments['xmlLogfile'], $arguments['logIncompleteSkipped']));
     }
     if (isset($arguments['testDatabaseDSN']) && isset($arguments['testDatabaseLogRevision']) && extension_loaded('pdo')) {
         $writeToTestDatabase = TRUE;
     } else {
         $writeToTestDatabase = FALSE;
     }
     if ($writeToTestDatabase) {
         $dbh = PHPUnit_Util_PDO::factory($arguments['testDatabaseDSN']);
         require_once 'PHPUnit/Util/Log/Database.php';
         $dbListener = PHPUnit_Util_Log_Database::getInstance($dbh, $arguments['testDatabaseLogRevision'], isset($arguments['testDatabaseLogInfo']) ? $arguments['testDatabaseLogInfo'] : '');
         $result->addListener($dbListener);
         $result->collectCodeCoverageInformation(TRUE);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups']);
     $result->flushListeners();
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $this->printer->printResult($result);
     }
     if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
         if (isset($arguments['coverageClover'])) {
             $this->printer->write("\nWriting code coverage data to XML file, this may take a moment.");
             require_once 'PHPUnit/Util/Log/CodeCoverage/XML/Clover.php';
             $writer = new PHPUnit_Util_Log_CodeCoverage_XML_Clover($arguments['coverageClover']);
             $writer->process($result);
             $this->printer->write("\n");
//.........这里部分代码省略.........
开发者ID:xiplias,项目名称:pails,代码行数:101,代码来源:TestRunner.php

示例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) {
         $this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
         self::$versionStringPrinted = true;
         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) {
//.........这里部分代码省略.........
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:101,代码来源:TestRunner.php

示例8: doRun

 /**
  * @param  PHPUnit_Framework_Test $suite
  * @param  array                   $parameters
  * @return PHPUnit_Framework_TestResult
  * @access public
  */
 public function doRun(PHPUnit_Framework_Test $suite, array $parameters = array())
 {
     $parameters['filter'] = isset($parameters['filter']) ? $parameters['filter'] : FALSE;
     $parameters['stopOnFailure'] = isset($parameters['stopOnFailure']) ? $parameters['stopOnFailure'] : FALSE;
     $parameters['repeat'] = isset($parameters['repeat']) ? $parameters['repeat'] : FALSE;
     $parameters['verbose'] = isset($parameters['verbose']) ? $parameters['verbose'] : FALSE;
     $parameters['wait'] = isset($parameters['wait']) ? $parameters['wait'] : FALSE;
     if (is_integer($parameters['repeat'])) {
         $suite = new PHPUnit_Extensions_RepeatedTest($suite, $parameters['repeat']);
     }
     if (isset($parameters['reportDirectory'])) {
         $parameters['reportDirectory'] = $this->getDirectory($parameters['reportDirectory']);
     }
     $result = $this->createTestResult();
     if ($parameters['stopOnFailure']) {
         $result->stopOnFailure(TRUE);
     }
     if ($this->printer === NULL) {
         if (isset($parameters['printer']) && $parameters['printer'] instanceof PHPUnit_Util_Printer) {
             $this->printer = $parameters['printer'];
         } else {
             $this->printer = new PHPUnit_TextUI_ResultPrinter(NULL, $parameters['verbose']);
         }
     }
     $this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
     $result->addListener($this->printer);
     if (isset($parameters['testdoxHTMLFile'])) {
         $result->addListener(PHPUnit_Util_TestDox_ResultPrinter::factory('HTML', $parameters['testdoxHTMLFile']));
     }
     if (isset($parameters['testdoxTextFile'])) {
         $result->addListener(PHPUnit_Util_TestDox_ResultPrinter::factory('Text', $parameters['testdoxTextFile']));
     }
     if (isset($parameters['graphvizLogfile'])) {
         if (class_exists('Image_GraphViz', FALSE)) {
             $result->addListener(new PHPUnit_Util_Log_GraphViz($parameters['graphvizLogfile']));
         }
     }
     if (isset($parameters['reportDirectory']) && extension_loaded('xdebug')) {
         if (class_exists('Image_GraphViz', FALSE)) {
             $result->addListener(new PHPUnit_Util_Report_GraphViz($parameters['reportDirectory']));
         }
         $result->addListener(new PHPUnit_TextUI_ResultPrinter($parameters['reportDirectory'] . '/logfile.txt', TRUE));
         $result->addListener(new PHPUnit_Util_Log_XML($parameters['reportDirectory'] . '/logfile.xml'));
         $result->addListener(new PHPUnit_Util_Log_TAP($parameters['reportDirectory'] . '/logfile.tap'));
         $result->collectCodeCoverageInformation(TRUE);
     }
     if (isset($parameters['jsonLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JSON($parameters['jsonLogfile']));
     }
     if (isset($parameters['tapLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_TAP($parameters['tapLogfile']));
     }
     if (isset($parameters['xmlLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_XML($parameters['xmlLogfile']));
     }
     if (isset($parameters['testDatabaseDSN']) && isset($parameters['testDatabaseLogRevision']) && extension_loaded('pdo')) {
         $writeToTestDatabase = TRUE;
     } else {
         $writeToTestDatabase = FALSE;
     }
     if ($writeToTestDatabase) {
         $dbh = new PDO($parameters['testDatabaseDSN']);
         $dbListener = PHPUnit_Util_Log_Database::getInstance($dbh, $parameters['testDatabaseLogRevision'], isset($parameters['testDatabaseLogInfo']) ? $parameters['testDatabaseLogInfo'] : '');
         $result->addListener($dbListener);
         $result->collectCodeCoverageInformation(TRUE);
     }
     $suite->run($result, $parameters['filter']);
     $result->flushListeners();
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $this->printer->printResult($result);
     }
     if ($writeToTestDatabase && extension_loaded('xdebug')) {
         $this->printer->write("\nStoring code coverage data in database, this may take a moment.");
         $testDb = new PHPUnit_Util_Database($dbh);
         $testDb->storeCodeCoverage($result, $parameters['testDatabaseLogRevision']);
         $this->printer->write("\n");
     }
     if (isset($parameters['reportDirectory']) && extension_loaded('xdebug')) {
         $this->printer->write("\nGenerating report, this may take a moment.");
         PHPUnit_Util_Report::render($result, $parameters['reportDirectory']);
         $this->printer->write("\n");
     }
     $this->pause($parameters['wait']);
     return $result;
 }
开发者ID:453111208,项目名称:bbc,代码行数:91,代码来源:TestRunner.php

示例9: 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'])) {
         $suite = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     }
     $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']));
     }
     if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory'])) && extension_loaded('xdebug')) {
         $result->setCodeCoverage($this->codeCoverage);
     }
     if (isset($arguments['logDbus'])) {
         $result->addListener(new PHPUnit_Util_Log_DBUS());
     }
     if (isset($arguments['jsonLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
     }
     if (isset($arguments['tapLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
     }
     if (isset($arguments['junitLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
     }
     if ($arguments['strict']) {
         $result->strictMode(TRUE);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     unset($suite);
     $result->flushListeners();
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $this->printer->printResult($result);
     }
     if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
         if (isset($arguments['coverageClover'])) {
             $this->printer->write("\nWriting code coverage data to XML file, this may take " . 'a moment.');
             $writer = new PHP_CodeCoverage_Report_Clover($arguments['cacheTokens']);
             $writer->process($this->codeCoverage, $arguments['coverageClover']);
             $this->printer->write("\n");
             unset($writer);
         }
//.........这里部分代码省略.........
开发者ID:proofek,项目名称:phpunit,代码行数:101,代码来源:TestRunner.php

示例10: 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 (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']);
         }
     }
     if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
         $this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
         self::$versionStringPrinted = true;
         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 (isset($arguments['coverageClover'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['coverageCrap4J'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['coverageHtml'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['coveragePHP'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['coverageText'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['coverageXml'])) {
         $codeCoverageReports++;
//.........这里部分代码省略.........
开发者ID:jmilagroso,项目名称:rijndael256encryptdecrypt,代码行数:101,代码来源:TestRunner.php

示例11: write

 /**
  * Override this method to automatically remove ansi codes
  */
 public function write($data)
 {
     if (!$this->colors) {
         $data = preg_replace("/\\[[^A-Za-z]*[A-Za-z]/", '', $data);
     }
     parent::write($data);
 }
开发者ID:rafeca,项目名称:Spec-PHP,代码行数:10,代码来源:ResultPrinter.php

示例12: doRun

 /**
  * @param  PHPUnit_Framework_Test $suite
  * @param  array                  $arguments
  * @return PHPUnit_Framework_TestResult
  * @access public
  */
 public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
 {
     $this->handleConfiguration($arguments);
     if (is_integer($arguments['repeat'])) {
         $suite = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups']);
     }
     $result = $this->createTestResult();
     if ($arguments['stopOnFailure']) {
         $result->stopOnFailure(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']);
         }
     }
     $this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\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']));
     }
     if (isset($arguments['graphvizLogfile'])) {
         if (class_exists('Image_GraphViz', FALSE)) {
             $result->addListener(new PHPUnit_Util_Log_GraphViz($arguments['graphvizLogfile']));
         }
     }
     if ((isset($arguments['coverageXML']) || isset($arguments['metricsXML']) || isset($arguments['pmdXML'])) && extension_loaded('xdebug')) {
         $result->collectCodeCoverageInformation(TRUE);
     }
     if (isset($arguments['reportDirectory']) && extension_loaded('xdebug')) {
         $result->collectCodeCoverageInformation(TRUE);
     }
     if (isset($arguments['jsonLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
     }
     if (isset($arguments['tapLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
     }
     if (isset($arguments['xmlLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_XML($arguments['xmlLogfile'], $arguments['logIncompleteSkipped']));
     }
     if (isset($arguments['testDatabaseDSN']) && isset($arguments['testDatabaseLogRevision']) && extension_loaded('pdo')) {
         $writeToTestDatabase = TRUE;
     } else {
         $writeToTestDatabase = FALSE;
     }
     if ($writeToTestDatabase) {
         $dbh = PHPUnit_Util_PDO::factory($arguments['testDatabaseDSN']);
         $dbListener = PHPUnit_Util_Log_Database::getInstance($dbh, $arguments['testDatabaseLogRevision'], isset($arguments['testDatabaseLogInfo']) ? $arguments['testDatabaseLogInfo'] : '');
         $result->addListener($dbListener);
         $result->collectCodeCoverageInformation(TRUE);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups']);
     $result->flushListeners();
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $this->printer->printResult($result);
     }
     if (isset($arguments['coverageXML']) && extension_loaded('tokenizer') && extension_loaded('xdebug')) {
         $this->printer->write("\nWriting code coverage data to XML file, this may take a moment.");
         $writer = new PHPUnit_Util_Log_CodeCoverage_XML($arguments['coverageXML']);
         $writer->process($result);
         $this->printer->write("\n");
     }
     if ($writeToTestDatabase && extension_loaded('tokenizer') && extension_loaded('xdebug')) {
         $this->printer->write("\nStoring code coverage and software metrics data in database.\nThis may take a moment.");
         $testDb = new PHPUnit_Util_Log_CodeCoverage_Database($dbh);
         $testDb->storeCodeCoverage($result, $dbListener->getRunId(), $arguments['testDatabaseLogRevision'], $arguments['testDatabasePrefix']);
         $this->printer->write("\n");
     }
     if (isset($arguments['metricsXML']) && extension_loaded('tokenizer') && extension_loaded('xdebug')) {
         $this->printer->write("\nWriting metrics report XML file, this may take a moment.");
         $writer = new PHPUnit_Util_Log_Metrics($arguments['metricsXML']);
         $writer->process($result);
         $this->printer->write("\n");
     }
     if (isset($arguments['pmdXML']) && extension_loaded('tokenizer') && extension_loaded('xdebug')) {
         $writer = new PHPUnit_Util_Log_PMD($arguments['pmdXML'], $arguments['pmd']);
         $this->printer->write("\nWriting violations report XML file, this may take a moment.");
         $writer->process($result);
         $writer = new PHPUnit_Util_Log_CPD(str_replace('.xml', '-cpd.xml', $arguments['pmdXML']));
         $writer->process($result, $arguments['cpdMinLines'], $arguments['cpdMinMatches']);
         $this->printer->write("\n");
     }
     if (isset($arguments['reportDirectory']) && extension_loaded('xdebug')) {
         $this->printer->write("\nGenerating code coverage report, this may take a moment.");
         PHPUnit_Util_Report::render($result, $arguments['reportDirectory'], $arguments['reportCharset'], $arguments['reportYUI'], $arguments['reportHighlight'], $arguments['reportLowUpperBound'], $arguments['reportHighLowerBound']);
         $this->printer->write("\n");
//.........这里部分代码省略.........
开发者ID:ahmedadham88,项目名称:enhanced-social-network,代码行数:101,代码来源:TestRunner.php


注:本文中的PHPUnit_TextUI_ResultPrinter::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。