mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 06:32:40 +01:00
23577a5f0f
- Pass 'pdf_variables' to CreateQuotePdf & CreateInvoicPdf - Update Playful & Plain to support new variable engine - Update DesignHelpers trait to support new variable engine - Make tests pass for ExampleIntegrationTest
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\PdfMaker;
|
|
|
|
use App\Models\Invoice;
|
|
use App\Services\PdfMaker\Designs\Playful;
|
|
use App\Services\PdfMaker\PdfMaker;
|
|
use App\Utils\HtmlEngine;
|
|
use App\Utils\Traits\MakesInvoiceValues;
|
|
use Tests\MockAccountData;
|
|
use Tests\TestCase;
|
|
|
|
class ExampleIntegrationTest extends TestCase
|
|
{
|
|
use MakesInvoiceValues, MockAccountData;
|
|
|
|
public function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->makeTestData();
|
|
}
|
|
|
|
public function testExample()
|
|
{
|
|
$invoice = $this->invoice;
|
|
$invitation = $invoice->invitations()->first();
|
|
|
|
$engine = new HtmlEngine(null, $invitation, 'invoice');
|
|
$design = new Playful();
|
|
|
|
$state = [
|
|
'template' => $design->elements([
|
|
'client' => $invoice->client,
|
|
'entity' => $invoice,
|
|
'pdf_variables' => (array)$invoice->company->settings->pdf_variables,
|
|
]),
|
|
'variables' => $engine->generateLabelsAndValues(),
|
|
];
|
|
|
|
$maker = new PdfMaker($state);
|
|
|
|
$maker
|
|
->design(Playful::class)
|
|
->build();
|
|
|
|
exec('echo "" > storage/logs/laravel.log');
|
|
|
|
info($maker->getCompiledHTML(true));
|
|
|
|
$this->assertTrue(true);
|
|
}
|
|
}
|