source: trunk/client/inc/hpdf5/spipu/html2pdf/src/Tests/Parsing/ParsingTest.php@ 412

Last change on this file since 412 was 347, checked in by roby, 4 years ago

Aggiornamento per compatibilità con php7.4

File size: 2.4 KB
Line 
1<?php
2/**
3 * Html2Pdf Library - Tests
4 *
5 * HTML => PDF converter
6 * distributed under the OSL-3.0 License
7 *
8 * @package Html2pdf
9 * @author Laurent MINGUET <webmaster@html2pdf.fr>
10 * @copyright 2017 Laurent MINGUET
11 */
12
13namespace Spipu\Html2Pdf\Tests\Parsing;
14
15use Spipu\Html2Pdf\Html2Pdf;
16use Spipu\Html2Pdf\Tests\AbstractTest;
17
18/**
19 * Class ParsingTest
20 */
21class ParsingTest extends AbstractTest
22{
23 /**
24 * test: The tag is unknown
25 *
26 * @return void
27 * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
28 */
29 public function testUnknownTag()
30 {
31 $object = $this->getObject();
32 $object->writeHTML('<bad_tag>Hello World</bad_tag>');
33 $object->output('test.pdf', 'S');
34 }
35
36 /**
37 * test: Too many tag closures found
38 *
39 * @return void
40 * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
41 */
42 public function testTooManyClosuresFound()
43 {
44 $object = $this->getObject();
45 $object->writeHTML('<i><u>Hello</u></i></b>');
46 $object->output('test.pdf', 'S');
47 }
48
49 /**
50 * test: Tags are closed in a wrong order
51 *
52 * @return void
53 * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
54 */
55 public function testWrongClosedOrder()
56 {
57 $object = $this->getObject();
58 $object->writeHTML('<b><u><i>Hello</u></i></b>');
59 $object->output('test.pdf', 'S');
60 }
61
62 /**
63 * test: The following tag has not been closed
64 *
65 * @return void
66 * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
67 */
68 public function testNotClosed()
69 {
70 $object = $this->getObject();
71 $object->writeHTML('<b><i>Hello</i>');
72 $object->output('test.pdf', 'S');
73 }
74
75 /**
76 * test: The following tags have not been closed
77 *
78 * @return void
79 * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
80 */
81 public function testNotClosedMore()
82 {
83 $object = $this->getObject();
84 $object->writeHTML('<b><u><i>Hello</i>');
85 $object->output('test.pdf', 'S');
86 }
87
88 /**
89 * test: The HTML tag code provided is invalid
90 *
91 * @return void
92 * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
93 */
94 public function testInvalidCode()
95 {
96 $object = $this->getObject();
97 $object->writeHTML('<az1-r_h>Hello</az1-r_h>');
98 $object->output('test.pdf', 'S');
99 }
100}
Note: See TracBrowser for help on using the repository browser.