1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Fixes for PdfMaker tests

This commit is contained in:
Benjamin Beganović 2020-08-10 18:06:12 +02:00
parent 347ec1d441
commit b5f2ae6d6b
2 changed files with 45 additions and 27 deletions

View File

@ -24,27 +24,30 @@ class PdfMakerDesignsTest extends TestCase
$this->state = [ $this->state = [
'variables' => [ 'variables' => [
'$css' => asset('css/tailwindcss@1.4.6.css'), 'labels' => [],
'$global-margin' => 'm-12', 'values' => [
'$global-padding' => 'p-12', '$css' => asset('css/tailwindcss@1.4.6.css'),
'$global-margin' => 'm-12',
'$global-padding' => 'p-12',
'$company-logo' => 'https://invoiceninja-invoice-templates.netlify.app/assets/images/invoiceninja-logo.png', '$company-logo' => 'https://invoiceninja-invoice-templates.netlify.app/assets/images/invoiceninja-logo.png',
'$company-name' => 'Invoice Ninja', '$company-name' => 'Invoice Ninja',
'$entity-number-label' => 'Invoice number', '$entity-number-label' => 'Invoice number',
'$entity-number' => '10000', '$entity-number' => '10000',
'$entity-date-label' => 'Invoice date', '$entity-date-label' => 'Invoice date',
'$entity-date' => '3th of June, 2025.', '$entity-date' => '3th of June, 2025.',
'$due-date-label' => 'Due date', '$due-date-label' => 'Due date',
'$due-date' => '5th of June, 2025.', '$due-date' => '5th of June, 2025.',
'$balance-due-label' => 'Balance due', '$balance-due-label' => 'Balance due',
'$balance-due' => '$800.50', '$balance-due' => '$800.50',
'$terms-label' => 'Terms', '$terms-label' => 'Terms',
'$terms' => 'Trend and SEO report has been sent via email. This is really long text just to test the width of the elements.', '$terms' => 'Trend and SEO report has been sent via email. This is really long text just to test the width of the elements.',
'$invoice-issued-to' => 'Invoice issued to:', '$invoice-issued-to' => 'Invoice issued to:',
'$entity' => 'Invoice', '$entity' => 'Invoice',
],
], ],
]; ];
} }
@ -707,7 +710,7 @@ class PdfMakerDesignsTest extends TestCase
$this->assertTrue(true); $this->assertTrue(true);
} }
public function testElegant() public function testElegant()
{ {
$state = [ $state = [
'template' => [ 'template' => [
@ -799,7 +802,7 @@ public function testElegant()
['element' => 'td', 'content' => '$2.00', 'properties' => ['class' => 'px-4 py-2 text-right']], ['element' => 'td', 'content' => '$2.00', 'properties' => ['class' => 'px-4 py-2 text-right']],
]], ]],
['element' => 'tr', 'content' => '', 'properties' => ['class' => 'mt-8 px-4 py-2'], 'elements' => [ ['element' => 'tr', 'content' => '', 'properties' => ['class' => 'mt-8 px-4 py-2'], 'elements' => [
['element' => 'td', 'content' => 'Balance due', 'properties' => ['class' => 'border-l-4 border-white px-4 text-right', 'colspan' => '4']], ['element' => 'td', 'content' => 'Balance due', 'properties' => ['class' => 'border-l-4 border-white px-4 text-right', 'colspan' => '4']],
['element' => 'td', 'content' => '$2.00', 'properties' => ['class' => 'px-4 py-2 text-right']], ['element' => 'td', 'content' => '$2.00', 'properties' => ['class' => 'px-4 py-2 text-right']],
]], ]],
]], ]],

View File

@ -10,7 +10,10 @@ class PdfMakerTest extends TestCase
{ {
public $state = [ public $state = [
'template' => [], 'template' => [],
'variables' => [], 'variables' => [
'labels' => [],
'values' => [],
],
]; ];
public function testDesignLoadsCorrectly() public function testDesignLoadsCorrectly()
@ -63,7 +66,10 @@ class PdfMakerTest extends TestCase
], ],
], ],
], ],
'variables' => [], 'variables' => [
'labels' => [],
'values' => [],
],
]; ];
$maker = new PdfMaker($state); $maker = new PdfMaker($state);
@ -97,7 +103,10 @@ class PdfMakerTest extends TestCase
], ],
], ],
'variables' => [ 'variables' => [
'$title' => 'Invoice Ninja', 'labels' => [],
'values' => [
'$title' => 'Invoice Ninja',
],
], ],
]; ];
@ -139,9 +148,12 @@ class PdfMakerTest extends TestCase
], ],
], ],
'variables' => [ 'variables' => [
'$company' => 'Invoice Ninja', 'labels' => [],
'$email' => 'contact@invoiceninja.com', 'values' => [
'$country' => 'UK', '$company' => 'Invoice Ninja',
'$email' => 'contact@invoiceninja.com',
'$country' => 'UK',
],
], ],
]; ];
@ -294,8 +306,11 @@ class PdfMakerTest extends TestCase
], ],
] ]
], ],
'variables' =>[ 'variables' => [
'$title' => 'Invoice Ninja', 'labels' => [],
'values' => [
'$title' => 'Invoice Ninja',
],
] ]
]; ];