diff --git a/tests/Pdf/PdfGenerationTest.php b/tests/Pdf/PdfGenerationTest.php index e995824f4999..0aaeff7b01ca 100644 --- a/tests/Pdf/PdfGenerationTest.php +++ b/tests/Pdf/PdfGenerationTest.php @@ -20,16 +20,127 @@ class PdfGenerationTest extends TestCase } + private function makePdf($header, $footer, $html, $pdf) + { + Browsershot::html($html) + //->showBrowserHeaderAndFooter() + //->headerHtml($header) + //->footerHtml($footer) + ->waitUntilNetworkIdle() + //->margins(10,10,10,10) + ->savePdf($pdf); + } public function testPdfGeneration() { $html = file_get_contents(base_path().'/tests/Pdf/invoice.html'); $pdf = base_path().'/tests/Pdf/invoice.pdf'; - Browsershot::html($html)->save($pdf); + + $header = '
'; + + $footer = '
+ / +
'; + + $this->makePdf($header, $footer, $html, $pdf); $this->assertTrue(file_exists($pdf)); + + unlink($pdf); + + } + + public function testPdfGeneration2() + { + $html = file_get_contents(base_path().'/tests/Pdf/invoice2.html'); + $pdf = base_path().'/tests/Pdf/invoice2.pdf'; + + + $header = '
'; + + $footer = '
+ / +
'; + + $this->makePdf($header, $footer, $html, $pdf); + + + $this->assertTrue(file_exists($pdf)); + + + unlink($pdf); + + } + + public function testPdfGeneration3() + { + $html = file_get_contents(base_path().'/tests/Pdf/invoice3.html'); + $pdf = base_path().'/tests/Pdf/invoice3.pdf'; + + + $header = '
'; + + $footer = '
+ / +
'; + + $this->makePdf($header, $footer, $html, $pdf); + + + $this->assertTrue(file_exists($pdf)); + + + unlink($pdf); + + } + + public function testPdfGeneration4() + { + $html = file_get_contents(base_path().'/tests/Pdf/invoice4.html'); + $pdf = base_path().'/tests/Pdf/invoice4.pdf'; + + + $header = '
'; + + $footer = '
+ / +
'; + + + $this->makePdf($header, $footer, $html, $pdf); + + + + $this->assertTrue(file_exists($pdf)); + + + unlink($pdf); + + } + + + public function testPdfGeneration5() + { + $html = file_get_contents(base_path().'/tests/Pdf/invoice5.html'); + $pdf = base_path().'/tests/Pdf/invoice5.pdf'; + + + $header = '
'; + + $footer = '
+ / +
'; + + + $this->makePdf($header, $footer, $html, $pdf); + + + + $this->assertTrue(file_exists($pdf)); + + unlink($pdf); } diff --git a/tests/Pdf/invoice.html b/tests/Pdf/invoice.html index 266d4b102977..e649be5a194a 100644 --- a/tests/Pdf/invoice.html +++ b/tests/Pdf/invoice.html @@ -5,6 +5,10 @@ A simple, clean, and responsive HTML invoice template + + +
+ +
+

Company Name

+
455 Foggy Heights, AZ 85004, US
+
(602) 519-0450
+ +
+
+ +
+
+
+
INVOICE TO:
+

John Doe

+
796 Silver Harbour, TX 79273, US
+ +
+
+

INVOICE 3-2-1

+
Date of Invoice: 01/06/2014
+
Due Date: 30/06/2014
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#DESCRIPTIONUNIT PRICEQUANTITYTOTAL
01

Website Design

Creating a recognizable design solution based on the company's existing visual identity
$40.0030$1,200.00
02

Website Development

Developing a Content Management System-based Website
$40.0080$3,200.00
03

Search Engines Optimization

Optimize the site for search engines (SEO)
$40.0020$800.00
SUBTOTAL$5,200.00
TAX 25%$1,300.00
GRAND TOTAL$6,500.00
+
Thank you!
+
+
NOTICE:
+
A finance charge of 1.5% will be made on unpaid balances after 30 days.
+
+
+
+ Invoice was created on a computer and is valid without the signature and seal. +
+ + \ No newline at end of file diff --git a/tests/Pdf/invoice3.html b/tests/Pdf/invoice3.html new file mode 100644 index 000000000000..6e8d91d81d06 --- /dev/null +++ b/tests/Pdf/invoice3.html @@ -0,0 +1,530 @@ + + + + + + Please pay {{ total }} due by {{ due_date }} + + + + + This is an invoice for your purchase on {{ purchase_date }}. Please submit payment by {{ due_date }} + + + + + + + \ No newline at end of file diff --git a/tests/Pdf/invoice4.html b/tests/Pdf/invoice4.html new file mode 100644 index 000000000000..9da23f36ff0e --- /dev/null +++ b/tests/Pdf/invoice4.html @@ -0,0 +1,234 @@ + + + + + + Example 3 + + + +
+ +

INVOICE 3-2-1

+
+
Company Name
+
455 Foggy Heights,
AZ 85004, US
+
(602) 519-0450
+ +
+
+
PROJECT Website development
+
CLIENT John Doe
+
ADDRESS 796 Silver Harbour, TX 79273, US
+ +
DATE August 17, 2015
+
DUE DATE September 17, 2015
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SERVICEDESCRIPTIONPRICEQTYTOTAL
DesignCreating a recognizable design solution based on the company's existing visual identity$40.0026$1,040.00
DevelopmentDeveloping a Content Management System-based Website$40.0080$3,200.00
SEOOptimize the site for search engines (SEO)$40.0020$800.00
TrainingInitial training sessions for staff responsible for uploading web content$40.004$160.00
SUBTOTAL$5,200.00
TAX 25%$1,300.00
GRAND TOTAL$6,500.00
+
+
NOTICE:
+
A finance charge of 1.5% will be made on unpaid balances after 30 days.
+
+
+
+ Invoice was created on a computer and is valid without the signature and seal. +
+ + \ No newline at end of file diff --git a/tests/Pdf/invoice5.html b/tests/Pdf/invoice5.html new file mode 100644 index 000000000000..a63b988341ed --- /dev/null +++ b/tests/Pdf/invoice5.html @@ -0,0 +1,293 @@ + + + + + + Example 3 + + + +
+

DATE
August 17, 2015
INVOICE 3-2-1 DUE DATE
September 17, 2015

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SERVICEDESCRIPTIONPRICEQTYTOTAL
DesignCreating a recognizable design solution based on the company's existing visual identity$40.0026$1,040.00
DevelopmentDeveloping a Content Management System-based Website$40.0080$3,200.00
SEOOptimize the site for search engines (SEO)$40.0020$800.00
TrainingInitial training sessions for staff responsible for uploading web content$40.004$160.00
SUBTOTAL$5,200.00
TAX 25%$1,300.00
GRAND TOTAL$6,500.00
+
+
+
PROJECT Website development
+
CLIENT John Doe
+
ADDRESS 796 Silver Harbour, TX 79273, US
+ +
+
+
Company Name COMPANY
+
455 Foggy Heights, AZ 85004, US ADDRESS
+
(602) 519-0450 PHONE
+ +
+
+
+
NOTICE:
+
A finance charge of 1.5% will be made on unpaid balances after 30 days.
+
+
+ + + \ No newline at end of file