pdf-finder/tests/ExampleDocumentAccess.php
2021-04-08 15:37:18 +02:00

30 lines
626 B
PHP

<?php
use IO\Filesystem\File;
use PDF\Document;
use PDF\Metadata;
trait ExampleDocumentAccess
{
protected function exampleDocument(?Metadata $metadata = null): Document
{
return new Document(
$this->exampleFile(),
$metadata ?? Metadata::empty()
);
}
protected function exampleDocumentWithMetadata(array $data): Document
{
return new Document(
$this->exampleFile(),
Metadata::fill($data)
);
}
protected function exampleFile(): File
{
return File::fromString(__DIR__ . '/resources/example.pdf');
}
}