/** * testFactoryReturnsFallbackFileSystemChangeSet * * @return void * @covers PHP_ChangeCoverage_ChangeSet_Factory * @group changeset * @group unittest */ public function testFactoryReturnsFallbackFileSystemChangeSet() { $path = $this->createDirectory('foo/bar/baz'); $factory = new PHP_ChangeCoverage_ChangeSet_Factory(); $changeSet = $factory->create(new PHP_ChangeCoverage_Source_File($path, array())); self::assertType('PHP_ChangeCoverage_ChangeSet_FileSystem', $changeSet); }
/** * 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; }