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


PHP PHPUnit_Util_Printer类代码示例

本文整理汇总了PHP中PHPUnit_Util_Printer的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_Printer类的具体用法?PHP PHPUnit_Util_Printer怎么用?PHP PHPUnit_Util_Printer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHPUnit_Util_Printer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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']));
 }
开发者ID:Vrian7ipx,项目名称:cascadadev,代码行数:7,代码来源:Printer.php

示例2: 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']);
//.........这里部分代码省略.........
开发者ID:kakserpom,项目名称:WakePHP,代码行数:101,代码来源:TestRunner.php

示例3: flush

 /**
  * Flush: Copy images and additional files to folder and generate index file using a template
  *
  * This method is called once after all tests have been processed.
  * HINT: The flush method is only called if the TestListener inherits from PHPUnit_Util_Printer
  *
  * @param array $templateVars
  * @return void
  * @author Fabrizio Branca
  */
 public function flush(array $templateVars = array())
 {
     $this->copyAdditionalFiles();
     $className = $this->viewClass;
     $view = new $className($this->templateFile);
     /* @var $view Menta_Util_View  */
     if (!$view instanceof Menta_Util_View) {
         throw new Exception('View must inherit from Menta_Util_View.');
     }
     foreach ($templateVars as $key => $value) {
         $view->assign($key, $value);
     }
     $this->write($view->render());
     return parent::flush();
 }
开发者ID:aoemedia,项目名称:menta,代码行数:25,代码来源:AbstractTemplatablePrinter.php

示例4: __construct

 public function __construct($out = null)
 {
     parent::__construct($out);
     self::$instance = $this;
     $this->setAutoFlush(true);
     $this->fd = fopen("php://fd/3", "w");
 }
开发者ID:vektah,项目名称:phpunit-parallel,代码行数:7,代码来源:SerializePrinter.php

示例5: __construct

 /**
  * {@inheritDoc}
  */
 public function __construct($out = null)
 {
     parent::__construct($out);
     if ($this->isDebug()) {
         $level = LogLevel::DEBUG;
     } elseif ($this->isVerbose()) {
         $level = LogLevel::INFO;
     } else {
         $level = LogLevel::NOTICE;
     }
     $this->setLogger(new \Psr3ConsoleLogger('PHPUnitPrinterLogger', $level));
 }
开发者ID:jclaveau,项目名称:phpunit-LoggerTestListener,代码行数:15,代码来源:bootstrap.printer.php

示例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);
         }
     });
     $flags = 0;
     if (defined('JSON_PRETTY_PRINT')) {
         $flags |= JSON_PRETTY_PRINT;
     }
     parent::write(json_encode($buffer, $flags));
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:16,代码来源:JSON.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param  mixed                       $out
  * @param  boolean                     $verbose
  * @param  boolean                     $colors
  * @param  boolean                     $debug
  * @throws PHPUnit_Framework_Exception
  * @since  Method available since Release 3.0.0
  */
 public function __construct($out = null, $verbose = false, $colors = false, $debug = false)
 {
     parent::__construct($out);
     if (is_bool($verbose)) {
         $this->verbose = $verbose;
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'boolean');
     }
     if (is_bool($colors)) {
         $console = new Console();
         $this->colors = $colors && $console->hasColorSupport();
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'boolean');
     }
     if (is_bool($debug)) {
         $this->debug = $debug;
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(4, 'boolean');
     }
 }
开发者ID:no-chris,项目名称:connector,代码行数:30,代码来源:ResultPrinter.php

示例8: flush

 /**
  * Flush buffer and close output.
  */
 public function flush()
 {
     if ($this->writeDocument === true) {
         $this->write($this->getXML());
     }
     parent::flush();
 }
开发者ID:ronaldbao,项目名称:phpunit,代码行数:10,代码来源:JUnit.php

示例9: __construct

 /**
  * Constructor.
  *
  * @param  mixed   $out
  * @param  boolean $verbose
  * @throws InvalidArgumentException
  * @access public
  * @since  Method available since Release 3.0.0
  */
 public function __construct($out = NULL, $verbose = FALSE)
 {
     parent::__construct($out);
     if (is_bool($verbose)) {
         $this->verbose = $verbose;
     } else {
         throw new InvalidArgumentException();
     }
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:18,代码来源:ResultPrinter.php

示例10: flush

 /**
  * Flush buffer and close output.
  */
 public function flush()
 {
     $this->write($this->document->saveXML());
     parent::flush();
 }
开发者ID:thanghexp,项目名称:project,代码行数:8,代码来源:XML.php

示例11: write

 /**
  * @param string $buffer
  */
 public function write($buffer)
 {
     parent::write(json_encode($buffer));
 }
开发者ID:streetparade,项目名称:phpunit,代码行数:7,代码来源:JSON.php

示例12: __construct

 /**
  * Constructor.
  *
  * @param  mixed   $out
  * @param  boolean $verbose
  * @param  boolean $colors
  * @param  boolean $debug
  * @throws InvalidArgumentException
  * @since  Method available since Release 3.0.0
  */
 public function __construct($out = NULL, $verbose = FALSE, $colors = FALSE, $debug = FALSE)
 {
     parent::__construct($out);
     if (is_bool($verbose)) {
         $this->verbose = $verbose;
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'boolean');
     }
     if (is_bool($colors)) {
         $this->colors = $colors;
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'boolean');
     }
     if (is_bool($debug)) {
         $this->debug = $debug;
     } else {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(4, 'boolean');
     }
 }
开发者ID:qcodo,项目名称:qcodo,代码行数:29,代码来源:ResultPrinter.php

示例13: flush

 /**
  * Flush buffer and close output.
  *
  * @access public
  */
 public function flush()
 {
     $this->write($this->graph->parse());
     parent::flush();
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:10,代码来源:GraphViz.php

示例14: flush

 /**
  * Flush buffer and close output.
  */
 public function flush()
 {
     $this->doEndClass();
     $this->endRun();
     parent::flush();
 }
开发者ID:luchaninov,项目名称:phpunit,代码行数:9,代码来源:ResultPrinter.php

示例15: write

 /**
  * @param string $buffer
  */
 public function write($buffer)
 {
     parent::write(json_encode($buffer, JSON_PRETTY_PRINT));
 }
开发者ID:ramonornela,项目名称:phpunit,代码行数:7,代码来源:JSON.php


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