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


PHP PHP_CodeCoverage::append方法代码示例

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


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

示例1: testSimpleMergeLegacy

 /**
  * Test merge for code coverage library 3 version
  *
  * @requires function \PHP_CodeCoverage::merge
  */
 public function testSimpleMergeLegacy()
 {
     $firstFile = PARATEST_ROOT . '/src/ParaTest/Logging/LogInterpreter.php';
     $secondFile = PARATEST_ROOT . '/src/ParaTest/Logging/MetaProvider.php';
     $filter = new \PHP_CodeCoverage_Filter();
     $filter->addFilesToWhitelist([$firstFile, $secondFile]);
     $coverage1 = new \PHP_CodeCoverage(null, $filter);
     $coverage1->append(array($firstFile => array(35 => 1), $secondFile => array(34 => 1)), 'Test1');
     $coverage2 = new \PHP_CodeCoverage(null, $filter);
     $coverage2->append(array($firstFile => array(35 => 1, 36 => 1)), 'Test2');
     $merger = new CoverageMerger();
     $this->call($merger, 'addCoverage', $coverage1);
     $this->call($merger, 'addCoverage', $coverage2);
     /** @var \PHP_CodeCoverage $coverage */
     $coverage = $this->getObjectValue($merger, 'coverage');
     $this->assertInstanceOf('\\PHP_CodeCoverage', $coverage);
     $data = $coverage->getData();
     $this->assertCount(2, $data[$firstFile][35]);
     $this->assertEquals('Test1', $data[$firstFile][35][0]);
     $this->assertEquals('Test2', $data[$firstFile][35][1]);
     $this->assertCount(1, $data[$firstFile][36]);
     $this->assertEquals('Test2', $data[$firstFile][36][0]);
     $this->assertCount(1, $data[$secondFile][34]);
     $this->assertEquals('Test1', $data[$secondFile][34][0]);
 }
开发者ID:brianium,项目名称:paratest,代码行数:30,代码来源:CoverageMergerTest.php

示例2: testAppendThrowsExceptionIfUsedCodeWasNotExecuted

 /**
  * @covers PHP_CodeCoverage::performUnexecutedCoveredCodeCheck
  * @expectedException PHP_CodeCoverage_CoveredCodeNotExecutedException
  */
 public function testAppendThrowsExceptionIfUsedCodeWasNotExecuted()
 {
     $this->coverage->filter()->addDirectoryToWhitelist(TEST_FILES_PATH);
     $this->coverage->setCheckForUnexecutedCoveredCode(true);
     $data = [TEST_FILES_PATH . 'BankAccount.php' => [29 => -1, 31 => -1]];
     $linesToBeCovered = [TEST_FILES_PATH . 'BankAccount.php' => [29, 31]];
     $linesToBeUsed = [TEST_FILES_PATH . 'BankAccount.php' => [22, 24]];
     $this->coverage->append($data, 'File1.php', true, $linesToBeCovered, $linesToBeUsed);
 }
开发者ID:ezrra,项目名称:PHP,代码行数:13,代码来源:CodeCoverageTest.php

示例3: testSimpleMerge

 public function testSimpleMerge()
 {
     $firstFile = PARATEST_ROOT . '/src/ParaTest/Logging/LogInterpreter.php';
     $secondFile = PARATEST_ROOT . '/src/ParaTest/Logging/MetaProvider.php';
     $coverage1 = new \PHP_CodeCoverage();
     $coverage1->append(array($firstFile => array(35 => 1), $secondFile => array(34 => 1)), 'Test1');
     $coverage2 = new \PHP_CodeCoverage();
     $coverage2->append(array($firstFile => array(35 => 1, 36 => 1)), 'Test2');
     $merger = new CoverageMerger();
     $merger->addCoverage($coverage1);
     $merger->addCoverage($coverage2);
     $coverage = $merger->getCoverage();
     $data = $coverage->getData();
     $this->assertEquals(2, count($data[$firstFile][35]));
     $this->assertEquals('Test1', $data[$firstFile][35][0]);
     $this->assertEquals('Test2', $data[$firstFile][35][1]);
     $this->assertEquals(1, count($data[$firstFile][36]));
     $this->assertEquals('Test2', $data[$firstFile][36][0]);
     $this->assertEquals(1, count($data[$secondFile][34]));
     $this->assertEquals('Test1', $data[$secondFile][34][0]);
 }
开发者ID:bruno-arsene,项目名称:paratest,代码行数:21,代码来源:CoverageMergerTest.php

示例4: testAppendThrowsExceptionForInvalidArgument

 /**
  * @covers            PHP_CodeCoverage::append
  * @expectedException PHP_CodeCoverage_Exception
  */
 public function testAppendThrowsExceptionForInvalidArgument()
 {
     $this->coverage->append(array(), null);
 }
开发者ID:limweb,项目名称:webappservice,代码行数:8,代码来源:CodeCoverageTest.php

示例5: testAppendThrowsExceptionForInvalidArgument

 /**
  * @covers            PHP_CodeCoverage::append
  * @expectedException InvalidArgumentException
  */
 public function testAppendThrowsExceptionForInvalidArgument()
 {
     $coverage = new PHP_CodeCoverage();
     $coverage->append(array(), NULL);
 }
开发者ID:rdohms,项目名称:php-code-coverage,代码行数:9,代码来源:CodeCoverageTest.php

示例6: rebuildCoverageData

 /**
  * This method takes a coverage report and then rebuilds the raw coverage
  * data based on the report data and the change history of the covered files.
  *
  * @param PHP_ChangeCoverage_Report $report The coverage report data.
  *
  * @return PHP_CodeCoverage
  */
 protected function rebuildCoverageData(PHP_ChangeCoverage_Report $report)
 {
     $codeCoverage = new PHP_CodeCoverage();
     $factory = new PHP_ChangeCoverage_ChangeSet_Factory();
     vcsCache::initialize($this->tempDirectory);
     $this->writeLine();
     $this->writeLine('Collecting commits and meta data, this may take a moment.');
     $this->writeLine();
     $xdebug = new PHP_ChangeCoverage_Xdebug();
     if ($this->unmodifiedAsCovered) {
         $xdebug->setUnmodifiedAsCovered();
     }
     foreach ($report->getFiles() as $file) {
         $changeSet = $factory->create($file);
         $changeSet->setStartDate($this->modifiedSince);
         foreach ($xdebug->generateData($changeSet->calculate()) as $data) {
             $codeCoverage->append($data, md5(microtime()));
         }
     }
     return $codeCoverage;
 }
开发者ID:johnkramlich,项目名称:php-change-coverage,代码行数:29,代码来源:Command.php

示例7: tearDown

 /**
  * Collect code coverage after the suite has been run
  *
  * @AfterSuite
  */
 public static function tearDown(SuiteEvent $event)
 {
     $parameters = $event->getContextParameters();
     if ($parameters['enableCodeCoverage']) {
         $client = new Client($parameters['url']);
         $response = $client->get('/', array('X-Enable-Coverage' => 1, 'X-Test-Session-Id' => self::$testSessionId, 'X-Collect-Coverage' => 1))->send();
         $data = unserialize((string) $response->getBody());
         $filter = new PHP_CodeCoverage_Filter();
         foreach ($parameters['whitelist'] as $dir) {
             $filter->addDirectoryToWhitelist($dir);
         }
         $coverage = new PHP_CodeCoverage(null, $filter);
         $coverage->append($data, 'behat-suite');
         $report = new PHP_CodeCoverage_Report_HTML();
         $report->process($coverage, $parameters['coveragePath']);
     }
 }
开发者ID:ASP96,项目名称:imbo,代码行数:22,代码来源:RESTContext.php

示例8: generateCoverageForFixture

 /**
  * @return \PHP_CodeCoverage
  */
 public function generateCoverageForFixture()
 {
     $coverage = new \PHP_CodeCoverage(null, null);
     $coverage->append(array(__DIR__ . '/../../fixture/NoNamespace/ExampleTest.php' => array(8 => 1, 9 => 1)), 'Nonamespace\\ExampleTest::testSomethingVerySpecial', true);
     return $coverage;
 }
开发者ID:julianseeger,项目名称:php-real-coverage,代码行数:9,代码来源:RealCoverageModifierTest.php


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