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


PHP PHP_CodeCoverage::getInstance方法代码示例

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


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

示例1: suite

 public static function suite()
 {
     $srcDir = dirname(dirname(dirname(__DIR__))) . '/src/Pyrus/AtomicFileTransaction/Transaction';
     // Setup coverage filters
     $filter = PHP_CodeCoverage::getInstance()->filter();
     $filter->addDirectoryToWhitelist($srcDir);
     // Build and return test suite
     return new PHPUnit_Extensions_PhptTestSuite(__DIR__);
 }
开发者ID:peopleplan,项目名称:Pyrus,代码行数:9,代码来源:AllTests.php

示例2: handleError

 public static function handleError($level, $message, $file, $line)
 {
     $isFiltered = false;
     if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0) {
         $isFiltered = PHP_CodeCoverage::getInstance()->filter()->isFiltered($file, array(), true);
     } else {
         $isFiltered = PHPUnit_Util_Filter::isFiltered($file, true, true);
     }
     if (!$isFiltered) {
         return PHPUnit_Util_ErrorHandler::handleError($level, $message, $file, $line);
     }
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:12,代码来源:PHPUnitTestRunner.php

示例3: prepare_harness

 protected function prepare_harness()
 {
     if ($this->ver_phpunit < 3.5) {
         require_once 'PHPUnit/Framework.php';
         require_once 'PHPUnit/TextUI/ResultPrinter.php';
         require_once 'PHPUnit/TextUI/Command.php';
         PHPUnit_Util_Filter::addDirectoryToFilter($this->root, '.php', 'PHPUNIT', '');
     } elseif ($this->ver_phpunit < 3.6) {
         require_once 'PHPUnit/Autoload.php';
         require_once 'PHP/CodeCoverage.php';
         PHP_CodeCoverage::getInstance()->filter()->addDirectoryToBlacklist($this->root, '.php', '', 'PHPUNIT');
     } else {
         // PHPUnit 3.6+
         /**
          * Change to support PHPUnit 4+
          * These libraries are loaded in via phpunit.phar or don't exist in PHPUnit 4+
          */
         //require_once( 'PHPUnit/Autoload.php' );
         //require_once( 'PHP/CodeCoverage.php' );
         $this->add_directory_to_blacklist($this->root, '.php');
     }
 }
开发者ID:Naatan,项目名称:komodo-phpunit-harness,代码行数:22,代码来源:HarnessSelector.php

示例4: __construct

 /**
  * Constructs a new TestSuite:
  *
  *   - PHPUnit_Framework_TestSuite() constructs an empty TestSuite.
  *
  *   - PHPUnit_Framework_TestSuite(ReflectionClass) constructs a
  *     TestSuite from the given class.
  *
  *   - PHPUnit_Framework_TestSuite(ReflectionClass, String)
  *     constructs a TestSuite from the given class with the given
  *     name.
  *
  *   - PHPUnit_Framework_TestSuite(String) either constructs a
  *     TestSuite from the given class (if the passed string is the
  *     name of an existing class) or constructs an empty TestSuite
  *     with the given name.
  *
  * @param  mixed  $theClass
  * @param  string $name
  * @throws InvalidArgumentException
  */
 public function __construct($theClass = '', $name = '')
 {
     $argumentsValid = FALSE;
     if (is_object($theClass) && $theClass instanceof ReflectionClass) {
         $argumentsValid = TRUE;
     } else {
         if (is_string($theClass) && $theClass !== '' && class_exists($theClass, FALSE)) {
             $argumentsValid = TRUE;
             if ($name == '') {
                 $name = $theClass;
             }
             $theClass = new ReflectionClass($theClass);
         } else {
             if (is_string($theClass)) {
                 $this->setName($theClass);
                 return;
             }
         }
     }
     if (!$argumentsValid) {
         throw new InvalidArgumentException();
     }
     if (!$theClass->isSubclassOf('PHPUnit_Framework_TestCase')) {
         throw new InvalidArgumentException('Class does not extend PHPUnit_Framework_TestCase.');
     }
     $filename = $theClass->getFilename();
     if (strpos($filename, 'eval()') === FALSE) {
         PHP_CodeCoverage::getInstance()->filter()->addFileToBlacklist(realpath($filename), 'TESTS');
     }
     if ($name != '') {
         $this->setName($name);
     } else {
         $this->setName($theClass->getName());
     }
     $constructor = $theClass->getConstructor();
     if ($constructor !== NULL && !$constructor->isPublic()) {
         $this->addTest(self::warning(sprintf('Class "%s" has no public constructor.', $theClass->getName())));
         return;
     }
     foreach ($theClass->getMethods() as $method) {
         if (strpos($method->getDeclaringClass()->getName(), 'PHPUnit_') !== 0) {
             $this->addTestMethod($theClass, $method);
         }
     }
     if (empty($this->tests)) {
         $this->addTest(self::warning(sprintf('No tests found in class "%s".', $theClass->getName())));
     }
     $this->testCase = TRUE;
 }
开发者ID:reflectivedevelopment,项目名称:jfh-lib,代码行数:70,代码来源:TestSuite.php

示例5: __construct

 /**
  * @param PHP_CodeCoverage $codeCoverage
  */
 public function __construct(PHP_CodeCoverage $codeCoverage = NULL)
 {
     if ($codeCoverage === NULL) {
         $codeCoverage = PHP_CodeCoverage::getInstance();
     }
     $this->codeCoverage = $codeCoverage;
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:10,代码来源:TestResult.php

示例6: handleConfiguration

 /**
  * @param  array $arguments
  * @since  Method available since Release 3.2.1
  */
 protected function handleConfiguration(array &$arguments)
 {
     if (isset($arguments['configuration']) && !$arguments['configuration'] instanceof PHPUnit_Util_Configuration) {
         $arguments['configuration'] = PHPUnit_Util_Configuration::getInstance($arguments['configuration']);
     }
     $arguments['debug'] = isset($arguments['debug']) ? $arguments['debug'] : FALSE;
     $arguments['filter'] = isset($arguments['filter']) ? $arguments['filter'] : FALSE;
     $arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : array();
     $arguments['wait'] = isset($arguments['wait']) ? $arguments['wait'] : FALSE;
     if (isset($arguments['configuration'])) {
         $arguments['configuration']->handlePHPConfiguration();
         $phpunitConfiguration = $arguments['configuration']->getPHPUnitConfiguration();
         if (isset($phpunitConfiguration['backupGlobals']) && !isset($arguments['backupGlobals'])) {
             $arguments['backupGlobals'] = $phpunitConfiguration['backupGlobals'];
         }
         if (isset($phpunitConfiguration['backupStaticAttributes']) && !isset($arguments['backupStaticAttributes'])) {
             $arguments['backupStaticAttributes'] = $phpunitConfiguration['backupStaticAttributes'];
         }
         if (isset($phpunitConfiguration['bootstrap']) && !isset($arguments['bootstrap'])) {
             $arguments['bootstrap'] = $phpunitConfiguration['bootstrap'];
         }
         if (isset($phpunitConfiguration['colors']) && !isset($arguments['colors'])) {
             $arguments['colors'] = $phpunitConfiguration['colors'];
         }
         if (isset($phpunitConfiguration['convertErrorsToExceptions']) && !isset($arguments['convertErrorsToExceptions'])) {
             $arguments['convertErrorsToExceptions'] = $phpunitConfiguration['convertErrorsToExceptions'];
         }
         if (isset($phpunitConfiguration['convertNoticesToExceptions']) && !isset($arguments['convertNoticesToExceptions'])) {
             $arguments['convertNoticesToExceptions'] = $phpunitConfiguration['convertNoticesToExceptions'];
         }
         if (isset($phpunitConfiguration['convertWarningsToExceptions']) && !isset($arguments['convertWarningsToExceptions'])) {
             $arguments['convertWarningsToExceptions'] = $phpunitConfiguration['convertWarningsToExceptions'];
         }
         if (isset($phpunitConfiguration['processIsolation']) && !isset($arguments['processIsolation'])) {
             $arguments['processIsolation'] = $phpunitConfiguration['processIsolation'];
         }
         if (isset($phpunitConfiguration['stopOnFailure']) && !isset($arguments['stopOnFailure'])) {
             $arguments['stopOnFailure'] = $phpunitConfiguration['stopOnFailure'];
         }
         if (isset($phpunitConfiguration['verbose']) && !isset($arguments['verbose'])) {
             $arguments['verbose'] = $phpunitConfiguration['verbose'];
         }
         $groupConfiguration = $arguments['configuration']->getGroupConfiguration();
         if (!empty($groupConfiguration['include']) && !isset($arguments['groups'])) {
             $arguments['groups'] = $groupConfiguration['include'];
         }
         if (!empty($groupConfiguration['exclude']) && !isset($arguments['excludeGroups'])) {
             $arguments['excludeGroups'] = $groupConfiguration['exclude'];
         }
         foreach ($arguments['configuration']->getListenerConfiguration() as $listener) {
             if (!class_exists($listener['class'], FALSE) && $listener['file'] !== '') {
                 $file = PHPUnit_Util_Filesystem::fileExistsInIncludePath($listener['file']);
                 if ($file !== FALSE) {
                     require $file;
                 }
             }
             if (class_exists($listener['class'], FALSE)) {
                 if (count($listener['arguments']) == 0) {
                     $listener = new $listener['class']();
                 } else {
                     $listenerClass = new ReflectionClass($listener['class']);
                     $listener = $listenerClass->newInstanceArgs($listener['arguments']);
                 }
                 if ($listener instanceof PHPUnit_Framework_TestListener) {
                     $arguments['listeners'][] = $listener;
                 }
             }
         }
         $loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
         if (isset($loggingConfiguration['coverage-html']) && !isset($arguments['reportDirectory'])) {
             if (isset($loggingConfiguration['charset']) && !isset($arguments['reportCharset'])) {
                 $arguments['reportCharset'] = $loggingConfiguration['charset'];
             }
             if (isset($loggingConfiguration['yui']) && !isset($arguments['reportYUI'])) {
                 $arguments['reportYUI'] = $loggingConfiguration['yui'];
             }
             if (isset($loggingConfiguration['highlight']) && !isset($arguments['reportHighlight'])) {
                 $arguments['reportHighlight'] = $loggingConfiguration['highlight'];
             }
             if (isset($loggingConfiguration['lowUpperBound']) && !isset($arguments['reportLowUpperBound'])) {
                 $arguments['reportLowUpperBound'] = $loggingConfiguration['lowUpperBound'];
             }
             if (isset($loggingConfiguration['highLowerBound']) && !isset($arguments['reportHighLowerBound'])) {
                 $arguments['reportHighLowerBound'] = $loggingConfiguration['highLowerBound'];
             }
             $arguments['reportDirectory'] = $loggingConfiguration['coverage-html'];
         }
         if (isset($loggingConfiguration['coverage-clover']) && !isset($arguments['coverageClover'])) {
             $arguments['coverageClover'] = $loggingConfiguration['coverage-clover'];
         }
         if (isset($loggingConfiguration['json']) && !isset($arguments['jsonLogfile'])) {
             $arguments['jsonLogfile'] = $loggingConfiguration['json'];
         }
         if (isset($loggingConfiguration['plain'])) {
             $arguments['listeners'][] = new PHPUnit_TextUI_ResultPrinter($loggingConfiguration['plain'], TRUE);
         }
//.........这里部分代码省略.........
开发者ID:sethcasana,项目名称:phpunit,代码行数:101,代码来源:TestRunner.php

示例7: testFactory

 /**
  * @covers PHP_CodeCoverage::getInstance
  */
 public function testFactory()
 {
     $coverage = PHP_CodeCoverage::getInstance();
     $this->assertSame($coverage, PHP_CodeCoverage::getInstance());
 }
开发者ID:rdohms,项目名称:php-code-coverage,代码行数:8,代码来源:CodeCoverageTest.php

示例8: getIncludedFilesAsString

 public static function getIncludedFilesAsString()
 {
     $blacklist = PHP_CodeCoverage::getInstance()->filter()->getBlacklist();
     $blacklist = array_flip($blacklist['PHPUNIT']);
     $files = get_included_files();
     $result = '';
     for ($i = count($files) - 1; $i > 0; $i--) {
         if (!isset($blacklist[$files[$i]]) && is_file($files[$i])) {
             $result = 'require_once \'' . $files[$i] . "';\n" . $result;
         }
     }
     return $result;
 }
开发者ID:arjenschol,项目名称:phpunit,代码行数:13,代码来源:GlobalState.php

示例9: getFilteredStacktrace

 /**
  * Filters stack frames from PHPUnit classes.
  *
  * @param  Exception $e
  * @param  boolean   $filterTests
  * @param  boolean   $asString
  * @return string
  */
 public static function getFilteredStacktrace(Exception $e, $filterTests = TRUE, $asString = TRUE)
 {
     if ($asString === TRUE) {
         $filteredStacktrace = '';
     } else {
         $filteredStacktrace = array();
     }
     $groups = array('DEFAULT');
     if (!defined('PHPUNIT_TESTSUITE')) {
         $groups[] = 'PHPUNIT';
     }
     if ($filterTests) {
         $groups[] = 'TESTS';
     }
     if ($e instanceof PHPUnit_Framework_SyntheticError) {
         $eTrace = $e->getSyntheticTrace();
     } else {
         $eTrace = $e->getTrace();
     }
     if (!self::frameExists($eTrace, $e->getFile(), $e->getLine())) {
         array_unshift($eTrace, array('file' => $e->getFile(), 'line' => $e->getLine()));
     }
     foreach ($eTrace as $frame) {
         if (isset($frame['file']) && is_file($frame['file']) && !PHP_CodeCoverage::getInstance()->filter()->isFiltered($frame['file'], $groups, TRUE)) {
             if ($asString === TRUE) {
                 $filteredStacktrace .= sprintf("%s:%s\n", $frame['file'], isset($frame['line']) ? $frame['line'] : '?');
             } else {
                 $filteredStacktrace[] = $frame;
             }
         }
     }
     return $filteredStacktrace;
 }
开发者ID:KnpLabs,项目名称:phpunit-easyinstall,代码行数:41,代码来源:Filter.php

示例10: die

$ini->loadCache();

// Be sure to have clean content language data
eZContentLanguage::expireCache();

$script->startup();
// $options = $script->getOptions();
$script->initialize();

// Avoids Fatal error: eZ Publish did not finish its request if die() is used.
eZExecution::setCleanExit();

$version = PHPUnit_Runner_Version::id();

if ( version_compare( $version, '3.5.0' ) == -1 && $version !== '@package_version@' )
{
    die( "PHPUnit 3.5.0 (or later) is required to run this test suite.\n" );
}

require_once 'PHP/CodeCoverage.php';
PHP_CodeCoverage::getInstance()->filter()->addFileToBlacklist( __FILE__, 'PHPUNIT' );

//require_once 'bootstrap.php';

$runner = ezpTestRunner::instance();
$runner->run($_SERVER['argv']);

$script->shutdown();

?>
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:30,代码来源:runtests.php


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