2019-05-04 05:14:37 +02:00
|
|
|
<?php
|
2020-12-25 14:15:57 +01:00
|
|
|
|
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
|
|
|
*
|
2022-06-21 11:57:17 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2020-09-14 13:11:46 +02:00
|
|
|
*/
|
2020-12-25 14:15:57 +01:00
|
|
|
|
2019-05-04 05:14:37 +02:00
|
|
|
namespace Tests\Pdf;
|
|
|
|
|
2020-12-23 16:17:05 +01:00
|
|
|
use Beganovich\Snappdf\Snappdf;
|
2019-05-04 05:14:37 +02:00
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
2023-02-21 08:39:07 +01:00
|
|
|
* @covers App\DataMapper\BaseSettings
|
2019-05-04 05:14:37 +02:00
|
|
|
*/
|
|
|
|
class PdfGenerationTest extends TestCase
|
|
|
|
{
|
2022-06-21 12:00:57 +02:00
|
|
|
protected function setUp(): void
|
2019-05-04 05:14:37 +02:00
|
|
|
{
|
2020-03-21 06:37:30 +01:00
|
|
|
parent::setUp();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testPdfGeneration()
|
|
|
|
{
|
2020-12-25 14:15:57 +01:00
|
|
|
$pdf = new Snappdf();
|
|
|
|
|
|
|
|
if (config('ninja.snappdf_chromium_path')) {
|
|
|
|
$pdf->setChromiumPath(config('ninja.snappdf_chromium_path'));
|
|
|
|
}
|
2019-05-04 08:55:19 +02:00
|
|
|
|
2021-07-07 02:47:50 +02:00
|
|
|
if (config('ninja.snappdf_chromium_arguments')) {
|
|
|
|
$pdf->clearChromiumArguments();
|
|
|
|
$pdf->addChromiumArguments(config('ninja.snappdf_chromium_arguments'));
|
|
|
|
}
|
|
|
|
|
2020-12-25 14:15:57 +01:00
|
|
|
$pdf = $pdf
|
2020-12-23 16:17:05 +01:00
|
|
|
->setHtml('<h1>Invoice Ninja</h1>')
|
|
|
|
->generate();
|
2019-05-04 08:55:19 +02:00
|
|
|
|
2020-12-23 16:17:05 +01:00
|
|
|
$this->assertNotNull($pdf);
|
2020-03-21 06:37:30 +01:00
|
|
|
}
|
2019-05-04 05:14:37 +02:00
|
|
|
}
|