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


PHP PHP_CodeCoverage::start方法代码示例

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


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

示例1: beforeExample

 public function beforeExample(ExampleEvent $event)
 {
     if (!$this->enabled) {
         return;
     }
     $example = $event->getExample();
     $resource = $example->getSpecification()->getResource();
     $this->coverage->filter()->setWhitelistedFiles([]);
     $this->coverage->filter()->addFileToWhitelist($resource->getSrcFilename());
     $this->coverage->start($resource->getSrcClassname());
 }
开发者ID:addvilz,项目名称:phpspec-cover,代码行数:11,代码来源:Listener.php

示例2: _start

 /**
  * Start coverage proccess
  */
 protected function _start()
 {
     if (!$this->_isStart && $this->_coverage) {
         $this->_isStart = true;
         $this->_coverage->start($this->_hash, true);
     }
 }
开发者ID:jbzoo,项目名称:phpunit,代码行数:10,代码来源:CovCatcher.php

示例3: init

 /**
  * @param Closure $callback
  * @return mixed
  */
 public function init(\Closure $callback)
 {
     if ($this->_coverage) {
         $this->_coverage->start($this->_covHash, true);
     }
     return $callback();
 }
开发者ID:JBZoo,项目名称:CrossCMS,代码行数:11,代码来源:fake-index.php

示例4: getCoverageForFileWithIgnoredLines

 protected function getCoverageForFileWithIgnoredLines()
 {
     $coverage = new PHP_CodeCoverage($this->setUpXdebugStubForFileWithIgnoredLines(), new PHP_CodeCoverage_Filter());
     $coverage->start('FileWithIgnoredLines', TRUE);
     $coverage->stop();
     return $coverage;
 }
开发者ID:rdohms,项目名称:php-code-coverage,代码行数:7,代码来源:TestCase.php

示例5: getCoverageForClassWithAnonymousFunction

 protected function getCoverageForClassWithAnonymousFunction()
 {
     $coverage = new PHP_CodeCoverage($this->setUpXdebugStubForClassWithAnonymousFunction(), new PHP_CodeCoverage_Filter());
     $coverage->start('ClassWithAnonymousFunction', true);
     $coverage->stop();
     return $coverage;
 }
开发者ID:xiaobudongzhang,项目名称:php-code-coverage,代码行数:7,代码来源:TestCase.php

示例6: renderRunningTest

 /**
  * Renders the screen for the function "Run tests" which shows and runs the actual unit tests.
  *
  * @return void
  */
 protected function renderRunningTest()
 {
     $this->setPhpUnitErrorHandler();
     $selectedTestableKey = $this->getAndSaveSelectedTestableKey();
     $this->renderTestingHeader($selectedTestableKey);
     $testablesToProcess = $this->collectTestablesToProcess($selectedTestableKey);
     $this->loadAllFilesContainingTestCasesForTestables($testablesToProcess);
     $testSuite = $this->createTestSuiteWithAllTestCases();
     $testResult = new PHPUnit_Framework_TestResult();
     $this->configureTestListener();
     $testResult->addListener($this->testListener);
     $this->testStatistics = t3lib_div::makeInstance('Tx_Phpunit_BackEnd_TestStatistics');
     $this->testStatistics->start();
     if ($this->shouldCollectCodeCoverageInformation()) {
         $this->coverage = t3lib_div::makeInstance('PHP_CodeCoverage');
         $this->coverage->start('phpunit');
     }
     if ($this->request->hasString(Tx_Phpunit_Interface_Request::PARAMETER_KEY_TEST)) {
         $this->runSingleTest($testSuite, $testResult);
     } elseif ($this->request->hasString(Tx_Phpunit_Interface_Request::PARAMETER_KEY_TESTCASE)) {
         $this->runTestCase($testSuite, $testResult);
     } else {
         $this->runAllTests($testSuite, $testResult);
     }
     $this->testStatistics->stop();
     $this->renderTestStatistics($testResult);
     $this->renderReRunButton();
     if ($this->shouldCollectCodeCoverageInformation()) {
         $this->renderCodeCoverage();
     }
 }
开发者ID:chrmue01,项目名称:typo3-starter-kit,代码行数:36,代码来源:Module.php

示例7: start

 public function start()
 {
     $this->fork();
     $coverage = new PHP_CodeCoverage();
     $coverage->start('child_process');
     register_shutdown_function(array($this, 'shutdown'), $coverage);
     $this->waitChild();
 }
开发者ID:tiagobutzke,项目名称:phparallel,代码行数:8,代码来源:CoverageCollectorThread.php

示例8: __begin_coverage

function __begin_coverage()
{
    global $__coverage;
    if (isset($__coverage)) {
        return;
    }
    if (!getenv("TEST_COVERAGE")) {
        return;
    }
    require_once "PHP/CodeCoverage.php";
    require_once "PHP/CodeCoverage/Driver.php";
    require_once "PHP/CodeCoverage/Driver/Xdebug.php";
    require_once "PHP/CodeCoverage/Filter.php";
    require_once "PHP/CodeCoverage/Util.php";
    require_once "File/Iterator/Facade.php";
    require_once "File/Iterator/Factory.php";
    require_once "File/Iterator.php";
    $__coverage = new PHP_CodeCoverage();
    $__coverage->start('test');
    $__coverage->filter()->addDirectoryToWhitelist(realpath(dirname(__FILE__) . "/../Modyllic"));
    register_shutdown_function('__end_coverage');
}
开发者ID:nmx,项目名称:Modyllic,代码行数:22,代码来源:test_environment.php

示例9: startCoverage

 /**
  * @BeforeScenario
  */
 public function startCoverage(BeforeScenarioScope $scope)
 {
     self::$coverage->start($this->getCoverageKeyFromScope($scope));
 }
开发者ID:victoire,项目名称:victoire,代码行数:7,代码来源:CoverageContext.php

示例10: startCoverageCollector

 /**
  * Starts coverage information collection for a test.
  *
  * @param string $testName Test name.
  * @return void
  */
 public function startCoverageCollector($testName)
 {
     if (isset($this->coverage)) {
         $this->coverage->start($testName);
     }
 }
开发者ID:benesch,项目名称:php-annotations,代码行数:12,代码来源:xTestRunner.php

示例11: run

 /**
  * Runs a TestCase.
  *
  * @param  PHPUnit_Framework_Test $test
  */
 public function run(PHPUnit_Framework_Test $test)
 {
     PHPUnit_Framework_Assert::resetCount();
     $error = FALSE;
     $failure = FALSE;
     $incomplete = FALSE;
     $skipped = FALSE;
     $this->startTest($test);
     $errorHandlerSet = FALSE;
     if ($this->convertErrorsToExceptions) {
         $oldErrorHandler = set_error_handler(array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL | E_STRICT);
         if ($oldErrorHandler === NULL) {
             $errorHandlerSet = TRUE;
         } else {
             restore_error_handler();
         }
     }
     if (self::$xdebugLoaded === NULL) {
         self::$xdebugLoaded = extension_loaded('xdebug');
         self::$useXdebug = self::$xdebugLoaded;
     }
     $useXdebug = self::$useXdebug && $this->codeCoverage !== NULL && !$test instanceof PHPUnit_Extensions_SeleniumTestCase && !$test instanceof PHPUnit_Framework_Warning;
     if ($useXdebug) {
         // We need to blacklist test source files when no whitelist is used.
         if (!$this->codeCoverage->filter()->hasWhitelist()) {
             $classes = PHPUnit_Util_Class::getHierarchy(get_class($test), TRUE);
             foreach ($classes as $class) {
                 $this->codeCoverage->filter()->addFileToBlacklist($class->getFileName());
             }
         }
         $this->codeCoverage->start($test);
     }
     PHP_Timer::start();
     try {
         if (!$test instanceof PHPUnit_Framework_Warning && $this->strictMode && extension_loaded('pcntl') && class_exists('PHP_Invoker')) {
             switch ($test->getSize()) {
                 case PHPUnit_Util_Test::SMALL:
                     $_timeout = $this->timeoutForSmallTests;
                     break;
                 case PHPUnit_Util_Test::MEDIUM:
                     $_timeout = $this->timeoutForMediumTests;
                     break;
                 case PHPUnit_Util_Test::LARGE:
                     $_timeout = $this->timeoutForLargeTests;
                     break;
             }
             $invoker = new PHP_Invoker();
             $invoker->invoke(array($test, 'runBare'), array(), $_timeout);
         } else {
             $test->runBare();
         }
     } catch (PHPUnit_Framework_AssertionFailedError $e) {
         $failure = TRUE;
         if ($e instanceof PHPUnit_Framework_IncompleteTestError) {
             $incomplete = TRUE;
         } else {
             if ($e instanceof PHPUnit_Framework_SkippedTestError) {
                 $skipped = TRUE;
             }
         }
     } catch (Exception $e) {
         $error = TRUE;
     }
     $time = PHP_Timer::stop();
     $test->addToAssertionCount(PHPUnit_Framework_Assert::getCount());
     if ($this->strictMode && $test->getNumAssertions() == 0) {
         $incomplete = TRUE;
     }
     if ($useXdebug) {
         try {
             $this->codeCoverage->stop(!$incomplete && !$skipped);
         } catch (PHP_CodeCoverage_Exception $cce) {
             $error = TRUE;
             if (!isset($e)) {
                 $e = $cce;
             }
         }
     }
     if ($errorHandlerSet === TRUE) {
         restore_error_handler();
     }
     if ($error === TRUE) {
         $this->addError($test, $e, $time);
     } else {
         if ($failure === TRUE) {
             $this->addFailure($test, $e, $time);
         } else {
             if ($this->strictMode && $test->getNumAssertions() == 0) {
                 $this->addFailure($test, new PHPUnit_Framework_IncompleteTestError('This test did not perform any assertions'), $time);
             } else {
                 if ($this->strictMode && $test->hasOutput()) {
                     $this->addFailure($test, new PHPUnit_Framework_OutputError(sprintf('This test printed output: %s', $test->getActualOutput())), $time);
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:qube81,项目名称:old-phpunit,代码行数:101,代码来源:TestResult.php

示例12: end_coverage

<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', '1');
if (function_exists('xdebug_get_code_coverage')) {
    if (@(include 'PHP/CodeCoverage/Autoload.php')) {
        $dir = dirname(__FILE__);
        $file = "{$dir}/coverage.state";
        if (file_exists($file)) {
            $coverage = unserialize(file_get_contents($file));
        } else {
            $coverage = new PHP_CodeCoverage();
        }
        $trace = debug_backtrace();
        $name = basename($trace[0]['file']);
        $coverage->start($name);
        register_shutdown_function('end_coverage');
    }
}
function end_coverage()
{
    $GLOBALS['coverage']->stop();
    $dir = dirname(__FILE__);
    $fh = fopen("{$dir}/coverage.state", 'w');
    fwrite($fh, serialize($GLOBALS['coverage']));
    fclose($fh);
}
$dir = dirname(__FILE__);
include $dir . '/testmore.php';
include $dir . '/../www/include/init.php';
$GLOBALS['log_handlers']['error'] = array('test_wrapper');
开发者ID:whosonfirst,项目名称:flamework,代码行数:31,代码来源:wrapper.php

示例13: run

 /**
  * Runs a TestCase.
  *
  * @param  PHPUnit_Framework_Test $test
  */
 public function run(PHPUnit_Framework_Test $test)
 {
     PHPUnit_Framework_Assert::resetCount();
     $error = FALSE;
     $failure = FALSE;
     $incomplete = FALSE;
     $skipped = FALSE;
     $this->startTest($test);
     $errorHandlerSet = FALSE;
     if ($this->convertErrorsToExceptions) {
         $oldErrorHandler = set_error_handler(array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL | E_STRICT);
         if ($oldErrorHandler === NULL) {
             $errorHandlerSet = TRUE;
         } else {
             restore_error_handler();
         }
     }
     if (self::$xdebugLoaded === NULL) {
         self::$xdebugLoaded = extension_loaded('xdebug');
         self::$useXdebug = self::$xdebugLoaded;
     }
     $useXdebug = self::$useXdebug && $this->codeCoverage !== NULL && !$test instanceof PHPUnit_Extensions_SeleniumTestCase && !$test instanceof PHPUnit_Framework_Warning;
     if ($useXdebug) {
         $this->codeCoverage->start($test);
     }
     PHP_Timer::start();
     try {
         $test->runBare();
     } catch (PHPUnit_Framework_AssertionFailedError $e) {
         $failure = TRUE;
         if ($e instanceof PHPUnit_Framework_IncompleteTestError) {
             $incomplete = TRUE;
         } else {
             if ($e instanceof PHPUnit_Framework_SkippedTestError) {
                 $skipped = TRUE;
             }
         }
     } catch (Exception $e) {
         $error = TRUE;
     }
     $time = PHP_Timer::stop();
     $test->addToAssertionCount(PHPUnit_Framework_Assert::getCount());
     if ($this->strictMode && $test->getNumAssertions() == 0) {
         $incomplete = TRUE;
     }
     if ($useXdebug) {
         try {
             $this->codeCoverage->stop(!$incomplete && !$skipped);
         } catch (PHP_CodeCoverage_Exception $cce) {
             $error = TRUE;
             if (!isset($e)) {
                 $e = $cce;
             }
         }
     }
     if ($errorHandlerSet === TRUE) {
         restore_error_handler();
     }
     if ($error === TRUE) {
         $this->addError($test, $e, $time);
     } else {
         if ($failure === TRUE) {
             $this->addFailure($test, $e, $time);
         } else {
             if ($this->strictMode && $test->getNumAssertions() == 0) {
                 $this->addFailure($test, new PHPUnit_Framework_IncompleteTestError('This test did not perform any assertions'), $time);
             } else {
                 if ($this->strictMode && $test->hasOutput()) {
                     $this->addFailure($test, new PHPUnit_Framework_OutputError(sprintf('This test printed output: %s', $test->getActualOutput())), $time);
                 }
             }
         }
     }
     $this->endTest($test, $time);
 }
开发者ID:proofek,项目名称:phpunit,代码行数:80,代码来源:TestResult.php

示例14: beforeScenario

 /**
  * Before Scenario/Outline Example hook
  *
  * @param \Behat\Behat\EventDispatcher\Event\ScenarioTested $event
  */
 public function beforeScenario(ScenarioTested $event)
 {
     $node = $event->getScenario();
     $id = $event->getFeature()->getFile() . ':' . $node->getLine();
     $this->coverage->start($id);
 }
开发者ID:vipsoft,项目名称:code-coverage-extension,代码行数:11,代码来源:EventListener.php

示例15: realpath

$testEnv = true;
ob_start();
if (!isset($opt['deployed'])) {
    include realpath(__DIR__ . '/fmt.src.php');
} else {
    include realpath(__DIR__ . '/../fmt.php');
}
ob_end_clean();
echo 'Running tests...', PHP_EOL;
$brokenTests = [];
$cases = glob(__DIR__ . '/tests/' . $testNumber . '*.in');
$count = 0;
$bailOut = false;
foreach ($cases as $caseIn) {
    ++$count;
    $isCoverage && $coverage->start($caseIn);
    $fmt = new CodeFormatter();
    $caseOut = str_replace('.in', '.out', $caseIn);
    $content = file_get_contents($caseIn);
    $tokens = token_get_all($content);
    $specialPasses = false;
    foreach ($tokens as $token) {
        list($id, $text) = getToken($token);
        if (T_COMMENT == $id && '//skipHHVM' == substr($text, 0, 10)) {
            $version = str_replace('//skipHHVM', '', $text);
            if ($isHHVM) {
                echo 'S';
                continue 2;
            }
        } elseif (!$shortTagEnabled && T_INLINE_HTML == $id && false !== strpos($text, '//skipShortTag')) {
            echo 'S';
开发者ID:nipsongarrido,项目名称:php.tools,代码行数:31,代码来源:test.php


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