stehen (wie in credit_details). */ beforeEach(function () { $this->pdfDir = storage_path('framework/testing/pdf-pipeline-'.uniqid()).'/'; File::ensureDirectoryExists($this->pdfDir); View::addLocation($this->pdfDir); File::put($this->pdfDir.'pdf-probe.blade.php', <<<'BLADE'

Seite eins

Seite zwei
BLADE); $GLOBALS['pdfProbePages'] = []; }); afterEach(function () { File::deleteDirectory($this->pdfDir); unset($GLOBALS['pdfProbePages']); }); test('embedded php runs on every page of an invoice pdf', function () { $file = (new InvoicePDF('pdf-probe'))->create([], 'probe.pdf', 'save', $this->pdfDir); expect($file)->toBe($this->pdfDir.'probe.pdf') ->and(file_get_contents($file))->toStartWith('%PDF') ->and($GLOBALS['pdfProbePages'])->toBe(['1/2', '2/2']); }); test('the rendered pdf can be laid onto the letterhead template', function () { $file = (new InvoicePDF('pdf-probe'))->create([], 'probe.pdf', 'save', $this->pdfDir); $merged = (new MyPDFMerger)->addPDF($file)->myMerge('string', 'probe.pdf', 'template_invoice_de'); File::put($this->pdfDir.'merged.pdf', $merged); expect($merged)->toStartWith('%PDF') ->and((new Fpdi)->setSourceFile($this->pdfDir.'merged.pdf'))->toBe(2); });