1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00
invoiceninja/tests/Feature/PdfMaker/ExampleIntegrationTest.php
Benjamin Beganović 50c37a8719 Update logic to support only one dynamic design class:
- New Design.php class that will act as master template
- PdfMaker->design() now accepts design object instead of string
- PdfMaker: Skip elements if no id|tag provided
- PdfMaker: 'content' property is now optional
- config/ninja.php now contains base_path for templates
- Refactored tests to be :green: ✔
- Removed PdfMakerDesignsTest since content is same for each template now
2020-09-04 10:18:41 +02:00

58 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature\PdfMaker;
use App\Models\Invoice;
use App\Services\PdfMaker\Design;
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 Design(
Design::CLEAN
);
$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($design)
->build();
// exec('echo "" > storage/logs/laravel.log');
// info($maker->getCompiledHTML(true));
$this->assertTrue(true);
}
}