Add checks

This commit is contained in:
Philipp Lang 2022-11-07 16:24:46 +01:00
parent 2ffab167ea
commit 5d6339c1ad
3 changed files with 23 additions and 0 deletions

View File

@ -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(), [

View File

@ -30,6 +30,19 @@ trait FakesCompilation
Assert::assertNotEmpty($validDocuments, 'Failed that TeX Document "'.$documentClass.'" has been compiled with given check.');
}
/**
* @param class-string<Document> $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<Document> $documentClass
*

View File

@ -5,6 +5,7 @@ namespace Zoomyboy\Tex;
use Illuminate\Support\Facades\Facade;
/**
* @method static void assertNotCompiled(class-string<Document> $documentClass)
* @method static void assertCompiled(class-string<Document> $documentClass, Closure(Document): bool $check)
* @method static void compile(Document $document)
*/