From 5d6339c1ad21307bc93d3fd30b0be773da4e05a4 Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Mon, 7 Nov 2022 16:24:46 +0100 Subject: [PATCH] Add checks --- src/BaseCompiler.php | 9 +++++++++ src/FakesCompilation.php | 13 +++++++++++++ src/Tex.php | 1 + 3 files changed, 23 insertions(+) diff --git a/src/BaseCompiler.php b/src/BaseCompiler.php index 56c0b6a..4abbcc9 100644 --- a/src/BaseCompiler.php +++ b/src/BaseCompiler.php @@ -42,6 +42,15 @@ abstract class BaseCompiler implements Responsable Storage::disk($disk)->put($name, $contents); } + public function storeIn(string $directory, string $disk): string + { + $contents = $this->file->getContent(); + + Storage::disk($disk)->put($this->file->getFilename(), $contents); + + return $this->file->getFilename(); + } + public function toResponse($request) { return response()->file($this->file->getRealPath(), [ diff --git a/src/FakesCompilation.php b/src/FakesCompilation.php index ddbb478..270339d 100644 --- a/src/FakesCompilation.php +++ b/src/FakesCompilation.php @@ -30,6 +30,19 @@ trait FakesCompilation Assert::assertNotEmpty($validDocuments, 'Failed that TeX Document "'.$documentClass.'" has been compiled with given check.'); } + /** + * @param class-string $documentClass + */ + public function assertNotCompiled(string $documentClass): void + { + $compilations = $this->getCompilations($documentClass); + + Assert::assertTrue( + $compilations->isEmpty(), + 'The TeX Document "'.$documentClass.'" should not have been compiled.' + ); + } + /** * @param class-string $documentClass * diff --git a/src/Tex.php b/src/Tex.php index 825f64d..e58abd3 100644 --- a/src/Tex.php +++ b/src/Tex.php @@ -5,6 +5,7 @@ namespace Zoomyboy\Tex; use Illuminate\Support\Facades\Facade; /** + * @method static void assertNotCompiled(class-string $documentClass) * @method static void assertCompiled(class-string $documentClass, Closure(Document): bool $check) * @method static void compile(Document $document) */