/** * Creates a changeset instance for the given source file. * * @param PHP_ChangeCoverage_Source_File $file * * @return PHP_ChangeCoverage_ChangeSet */ public function create(PHP_ChangeCoverage_Source_File $file) { if (is_object($vcs = $this->createVcsFile($file->getPath()))) { return new PHP_ChangeCoverage_ChangeSet_VersionControl($vcs, $file); } return new PHP_ChangeCoverage_ChangeSet_FileSystem($file); }
/** * Calculates the changed lines for the context source file and returns a * prepared file instance where the <b>hasChanged()</b> flag is set to * <b>true</b>. * * @return PHP_ChangeCoverage_Source_File */ public function calculate() { if (filemtime($this->file->getPath()) >= $this->startDate) { $this->updateChangedStatus(); } return $this->file; }
/** * This method creates an array with coverage data similar to that arrays * which xdebug's coverage code generates. * * This method sets an internal execution flag to <b>true</b> when there is * more coverage information available than the current array contains. * * @return array(integer=>integer) */ protected function createXdebugCoverageArray() { $this->stopExecution = true; $xdebug = array(); foreach ($this->file->getLines() as $line) { if ($line->hasChanged($line)) { if ($line->getCount() === 0) { $xdebug[$line->getNumber()] = -1; } else { if ($line->decrementCount() > 0) { $this->stopExecution = false; } $xdebug[$line->getNumber()] = 1; } } else { $xdebug[$line->getNumber()] = $this->unmodifiedLineStatus; } } return array($this->file->getPath() => $xdebug); }
/** * testGetPathReturnsFullQualifiedFileName * * @return void * @covers PHP_ChangeCoverage_Source_File * @group source * @group unittest */ public function testGetPathReturnsFullQualifiedFileName() { $file = new PHP_ChangeCoverage_Source_File(__FILE__, array()); self::assertEquals(__FILE__, $file->getPath()); }