Add checks
This commit is contained in:
parent
2ffab167ea
commit
5d6339c1ad
|
@ -42,6 +42,15 @@ abstract class BaseCompiler implements Responsable
|
||||||
Storage::disk($disk)->put($name, $contents);
|
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)
|
public function toResponse($request)
|
||||||
{
|
{
|
||||||
return response()->file($this->file->getRealPath(), [
|
return response()->file($this->file->getRealPath(), [
|
||||||
|
|
|
@ -30,6 +30,19 @@ trait FakesCompilation
|
||||||
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
|
||||||
|
*/
|
||||||
|
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
|
* @param class-string<Document> $documentClass
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace Zoomyboy\Tex;
|
||||||
use Illuminate\Support\Facades\Facade;
|
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 assertCompiled(class-string<Document> $documentClass, Closure(Document): bool $check)
|
||||||
* @method static void compile(Document $document)
|
* @method static void compile(Document $document)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue