$document =
$this->documentRepository->
search( new Criteria([$invoiceStruct->
getId()]),
$this->context,
)->
first();
static::
assertNotNull($document);
static::
assertInstanceOf(DocumentEntity::
class,
$document);
$mediaId =
$document->
getDocumentMediaFileId();
static::
assertNotNull($mediaId);
$media =
$this->context->
scope(Context::SYSTEM_SCOPE,
fn (Context
$context) =>
$this->
getContainer()->
get(FileLoader::
class)->
loadMediaFileStream($mediaId,
$context));
static::
assertInstanceOf(StreamInterface::
class,
$media);
static::
assertNotNull($media->
getContents());
} public function testReadStaticGeneratedDocument(): void
{ $operation =
new DocumentGenerateOperation($this->orderId, FileTypes::PDF,
[], null, true
);
$invoiceStruct =
$this->documentGenerator->
generate(InvoiceRenderer::TYPE,
[$this->orderId =>
$operation],
$this->context
)->
getSuccess()->
first();
static::
assertNotNull($invoiceStruct);