[wip] add tests
This commit is contained in:
29
tests/ExampleDocumentAccess.php
Normal file
29
tests/ExampleDocumentAccess.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user