當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。