Add full body assertion

This commit is contained in:
Philipp Lang 2023-11-29 23:00:47 +01:00
parent 5a5f1756e1
commit 8654d13e81
1 changed files with 12 additions and 3 deletions

View File

@ -22,12 +22,21 @@ trait FakesCompilation
Assert::assertFalse(
$compilations->isEmpty(),
'The TeX Document "'.$documentClass.'" has not been compiled.'
'The TeX Document "' . $documentClass . '" has not been compiled.'
);
$validDocuments = $compilations->filter(fn ($compilation) => $check($compilation));
Assert::assertNotEmpty($validDocuments, 'Failed that TeX Document "'.$documentClass.'" has been compiled with given check.');
Assert::assertNotEmpty($validDocuments, 'Failed that TeX Document "' . $documentClass . '" has been compiled with given check.');
}
/**
* @param class-string<Document> $documentClass
* @param callable(Document): bool $check
*/
public function assertCompiledContent(string $documentClass, string $content): void
{
$this->assertCompiled($documentClass, fn ($document) => $document->renderBody() === $content);
}
/**
@ -39,7 +48,7 @@ trait FakesCompilation
Assert::assertTrue(
$compilations->isEmpty(),
'The TeX Document "'.$documentClass.'" should not have been compiled.'
'The TeX Document "' . $documentClass . '" should not have been compiled.'
);
}