コード例 #1
0
 public function testObtainsCodeCoverageInformationFromAPossiblyRemoteHttpServer()
 {
     $coverageScriptUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL . '/coverage/dummy.txt';
     $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage($coverageScriptUrl, 'dummyTestId');
     $content = $coverage->get();
     $dummyClassSourceFile = dirname(__FILE__) . '/DummyClass.php';
     $expectedCoverage = array(3 => 1, 6 => 1, 7 => -2, 11 => -1, 12 => -2, 14 => 1);
     $this->assertEquals($expectedCoverage, $content[$dummyClassSourceFile]);
 }
コード例 #2
0
 /**
  * Reimplemented to allow us to collect code coverage info from the target server.
  * Code taken from PHPUnit_Extensions_Selenium2TestCase
  *
  * @param PHPUnit_Framework_TestResult $result
  * @return PHPUnit_Framework_TestResult
  * @throws Exception
  */
 public function run(PHPUnit_Framework_TestResult $result = NULL)
 {
     $this->testId = get_class($this) . '__' . $this->getName();
     if ($result === NULL) {
         $result = $this->createResult();
     }
     $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
     parent::run($result);
     if ($this->collectCodeCoverageInformation) {
         $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage($this->coverageScriptUrl, $this->testId);
         $result->getCodeCoverage()->append($coverage->get(), $this);
     }
     // do not call this before to give the time to the Listeners to run
     //$this->getStrategy()->endOfTest($this->session);
     return $result;
 }
コード例 #3
0
 /**
  * @return array
  */
 protected function getCodeCoverage()
 {
     $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage($this->coverageScriptUrl, $this->testId);
     return $coverage->get();
 }