/** * @covers phpDocumentor\Parser\Parser::setPath * @covers phpDocumentor\Parser\Parser::getPath */ public function testSettingAndRetrievingTheBasePath() { // Arrange $this->assertSame('', $this->fixture->getPath()); // Act $this->fixture->setPath(sys_get_temp_dir()); // Assert $this->assertSame(sys_get_temp_dir(), $this->fixture->getPath()); }
/** * Returns the filename, relative to the root of the project directory. * * @param string $filename The filename to make relative. * * @throws \InvalidArgumentException if file is not in the project root. * * @return string */ public function getRelativeFilename($filename) { // strip path from filename $result = ltrim(substr($filename, strlen($this->parser->getPath())), DIRECTORY_SEPARATOR); if ($result === '') { throw new \InvalidArgumentException('File is not present in the given project path: ' . $filename); } return $result; }