/** * @param PHPUnit_Framework_TestResult $result * @return PHPUnit_Framework_TestResult */ public function run(PHPUnit_Framework_TestResult $result = null) { // include kernel to be sure that serialized result containing it will be successfully unserialized static::loadKernelClass(); return parent::run($result); }
/** * @param \PHPUnit_Framework_TestResult $result * * @return \PHPUnit_Framework_TestResult */ public function run(\PHPUnit_Framework_TestResult $result = null) { if (null === $result) { $result = $this->createResult(); } $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation(); parent::run($result); if (($mink = $this->getMink()) && 'symfony' != $mink->getDefaultSessionName() && $this->collectCodeCoverageInformation && $this->coverageScriptUrl) { $session = $mink->getSession('goutte'); $url = sprintf('%s?PHPUNIT_SELENIUM_TEST_ID=%s', $this->coverageScriptUrl, $this->testId); $session->visit($url); $coverage = array(); if ($content = $session->getPage()->getContent()) { $coverage = unserialize($content); if (is_array($coverage)) { $coverage = $this->matchLocalAndRemotePaths($coverage); } else { throw new \RuntimeException('Empty or invalid code coverage data received from url "' . $url . '"'); } } $result->getCodeCoverage()->append($coverage, $this); } return $result; }