2020-07-29 13:37:05 +02:00
|
|
|
<?php
|
2020-09-14 13:11:46 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-09-14 13:11:46 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2022-06-21 11:57:17 +02:00
|
|
|
|
2020-07-29 13:37:05 +02:00
|
|
|
namespace Tests\Feature\PdfMaker;
|
|
|
|
|
2020-09-04 10:18:41 +02:00
|
|
|
use App\Services\PdfMaker\Design;
|
2020-07-29 13:37:05 +02:00
|
|
|
use App\Services\PdfMaker\PdfMaker;
|
|
|
|
use App\Utils\HtmlEngine;
|
2020-07-30 17:47:40 +02:00
|
|
|
use App\Utils\Traits\MakesInvoiceValues;
|
2020-08-10 18:40:04 +02:00
|
|
|
use Tests\MockAccountData;
|
2020-07-29 13:37:05 +02:00
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class ExampleIntegrationTest extends TestCase
|
|
|
|
{
|
2020-08-10 18:40:04 +02:00
|
|
|
use MakesInvoiceValues, MockAccountData;
|
|
|
|
|
2022-06-21 12:00:57 +02:00
|
|
|
protected function setUp(): void
|
2020-08-10 18:40:04 +02:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->makeTestData();
|
|
|
|
}
|
2020-07-30 17:47:40 +02:00
|
|
|
|
2020-07-29 13:37:05 +02:00
|
|
|
public function testExample()
|
|
|
|
{
|
2020-09-04 13:17:30 +02:00
|
|
|
$this->markTestIncomplete();
|
|
|
|
|
2020-08-10 18:40:04 +02:00
|
|
|
$invoice = $this->invoice;
|
2020-07-29 13:37:05 +02:00
|
|
|
$invitation = $invoice->invitations()->first();
|
|
|
|
|
2020-10-27 12:57:12 +01:00
|
|
|
$engine = new HtmlEngine($invitation);
|
2020-09-04 10:18:41 +02:00
|
|
|
|
|
|
|
$design = new Design(
|
|
|
|
Design::CLEAN
|
|
|
|
);
|
2020-07-30 17:47:40 +02:00
|
|
|
|
2020-07-29 13:37:05 +02:00
|
|
|
$state = [
|
2020-07-30 17:47:40 +02:00
|
|
|
'template' => $design->elements([
|
|
|
|
'client' => $invoice->client,
|
2020-08-05 11:52:01 +02:00
|
|
|
'entity' => $invoice,
|
2020-09-06 11:38:10 +02:00
|
|
|
'pdf_variables' => (array) $invoice->company->settings->pdf_variables,
|
2020-07-30 17:47:40 +02:00
|
|
|
]),
|
2020-07-29 13:37:05 +02:00
|
|
|
'variables' => $engine->generateLabelsAndValues(),
|
|
|
|
];
|
|
|
|
|
2020-08-07 17:47:17 +02:00
|
|
|
$maker = new PdfMaker($state);
|
2020-07-29 13:37:05 +02:00
|
|
|
|
|
|
|
$maker
|
2020-09-04 10:18:41 +02:00
|
|
|
->design($design)
|
2020-07-29 13:37:05 +02:00
|
|
|
->build();
|
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
// exec('echo "" > storage/logs/laravel.log');
|
2020-08-04 17:32:28 +02:00
|
|
|
|
2020-12-29 22:10:03 +01:00
|
|
|
// nlog($maker->getCompiledHTML(true));
|
2020-08-04 17:32:28 +02:00
|
|
|
|
|
|
|
$this->assertTrue(true);
|
2020-07-29 13:37:05 +02:00
|
|
|
}
|
|
|
|
}
|