/** * Creates a new Descriptor from the given Reflector. * * @param ExampleTag $data * * @throws \InvalidArgumentException if the provided parameter is not of type ExampleTag; the interface won't let * up typehint the signature. * * @return ExampleDescriptor */ public function create($data) { if (!$data instanceof ExampleTag) { throw new \InvalidArgumentException('The ExampleAssembler expected an ExampleTag object to base the descriptor on'); } $descriptor = new ExampleDescriptor($data->getName()); $descriptor->setFilePath((string) $data->getFilePath()); $descriptor->setStartingLine($data->getStartingLine()); $descriptor->setLineCount($data->getLineCount()); $descriptor->setDescription($data->getDescription()); $descriptor->setExample($this->finder->find($descriptor)); return $descriptor; }
/** * @covers phpDocumentor\Descriptor\Example\Finder::find * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents */ public function testErrorMessageIsReturnedIfFileIsNotFound() { $filename = 'doesNotExist.txt'; $descriptor = $this->givenADescriptorWithExamplePath($filename); $result = $this->fixture->find($descriptor); $this->assertSame("** File not found : {$filename} **", $result); }