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 |
|
---|
13 | namespace Spipu\Html2Pdf\Tests\Tag;
|
---|
14 |
|
---|
15 | use Spipu\Html2Pdf\Html2Pdf;
|
---|
16 | use Spipu\Html2Pdf\Tests\AbstractTest;
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Class Thead must not be empty
|
---|
20 | */
|
---|
21 | class MustHaveTagsTest extends AbstractTest
|
---|
22 | {
|
---|
23 | /**
|
---|
24 | * test
|
---|
25 | *
|
---|
26 | * @return void
|
---|
27 | */
|
---|
28 | public function testOk()
|
---|
29 | {
|
---|
30 | $html = '<table>';
|
---|
31 | $html.= '<thead><tr><td>Hello</td></tr></thead>';
|
---|
32 | $html.= '<tbody><tr><td>World</td></tr></tbody>';
|
---|
33 | $html.= '</table>';
|
---|
34 |
|
---|
35 | $object = $this->getObject();
|
---|
36 | $object->writeHTML($html);
|
---|
37 | $result = $object->output('test.pdf', 'S');
|
---|
38 |
|
---|
39 | $this->assertNotEmpty($result);
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * test
|
---|
44 | *
|
---|
45 | * @return void
|
---|
46 | * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
|
---|
47 | */
|
---|
48 | public function testNotEmptyThead()
|
---|
49 | {
|
---|
50 | $html = '<table>';
|
---|
51 | $html.= '<thead></thead>';
|
---|
52 | $html.= '<tbody><tr><td>World</td></tr></tbody>';
|
---|
53 | $html.= '</table>';
|
---|
54 |
|
---|
55 | $object = $this->getObject();
|
---|
56 | $object->writeHTML($html);
|
---|
57 | $object->output('test.pdf', 'S');
|
---|
58 | }
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * test
|
---|
62 | *
|
---|
63 | * @return void
|
---|
64 | * @expectedException \Spipu\Html2Pdf\Exception\HtmlParsingException
|
---|
65 | */
|
---|
66 | public function testNotEmptyTfoot()
|
---|
67 | {
|
---|
68 | $html = '<table>';
|
---|
69 | $html.= '<tfoot></tfoot>';
|
---|
70 | $html.= '<tbody><tr><td>World</td></tr></tbody>';
|
---|
71 | $html.= '</table>';
|
---|
72 |
|
---|
73 | $object = $this->getObject();
|
---|
74 | $object->writeHTML($html);
|
---|
75 | $object->output('test.pdf', 'S');
|
---|
76 | }
|
---|
77 | }
|
---|