1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/tests/Feature/PdfMaker/ExampleIntegrationTest.php
Benjamin Beganović 13e70e24d5 wip
2020-08-21 16:47:17 +02:00

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);
}
}