|
5 | 5 | namespace PhpOffice\PhpSpreadsheetTests\Reader\Html; |
6 | 6 |
|
7 | 7 | use PhpOffice\PhpSpreadsheet\Reader\Html; |
8 | | -use PhpOffice\PhpSpreadsheet\Spreadsheet; |
9 | 8 | use PHPUnit\Framework\TestCase; |
10 | 9 |
|
11 | 10 | /** |
|
16 | 15 | */ |
17 | 16 | class HtmlLibxmlTest extends TestCase |
18 | 17 | { |
19 | | - private Spreadsheet $spreadsheet; |
20 | | - |
21 | | - protected function tearDown(): void |
| 18 | + public function testAll(): void |
22 | 19 | { |
23 | | - $this->spreadsheet->disconnectWorksheets(); |
24 | | - unset($this->spreadsheet); |
| 20 | + if (LIBXML_VERSION >= 21400) { |
| 21 | + self::markTestSkipped('Current version of libxml has invalidated these tests'); |
| 22 | + } |
| 23 | + $this->xtestLoadInvalidString(); |
| 24 | + $this->xtestLoadValidString(); |
| 25 | + $this->xtestLoadValidStringNoSuppress(); |
| 26 | + $this->xtestLoadValidFile(); |
| 27 | + $this->xtestLoadInvalidFile(); |
25 | 28 | } |
26 | 29 |
|
27 | | - public function testLoadInvalidString(): void |
| 30 | + public function xtestLoadInvalidString(): void |
28 | 31 | { |
29 | 32 | $libxml = libxml_use_internal_errors(); |
30 | 33 | $html = '<table<>'; |
31 | 34 | $reader = new Html(); |
32 | 35 | $reader->setSuppressLoadWarnings(true); |
33 | | - $this->spreadsheet = $reader->loadFromString($html); |
| 36 | + $spreadsheet = $reader->loadFromString($html); |
34 | 37 | self::assertNotEmpty($reader->getLibxmlMessages()); |
35 | 38 | self::assertSame($libxml, libxml_use_internal_errors()); |
| 39 | + $spreadsheet->disconnectWorksheets(); |
36 | 40 | } |
37 | 41 |
|
38 | | - public function testLoadValidString(): void |
| 42 | + public function xtestLoadValidString(): void |
39 | 43 | { |
40 | 44 | $libxml = libxml_use_internal_errors(); |
41 | 45 | $html = '<table>'; |
42 | 46 | $reader = new Html(); |
43 | 47 | $reader->setSuppressLoadWarnings(true); |
44 | | - $this->spreadsheet = $reader->loadFromString($html); |
| 48 | + $spreadsheet = $reader->loadFromString($html); |
45 | 49 | self::assertEmpty($reader->getLibxmlMessages()); |
46 | 50 | self::assertSame($libxml, libxml_use_internal_errors()); |
| 51 | + $spreadsheet->disconnectWorksheets(); |
47 | 52 | } |
48 | 53 |
|
49 | | - public function testLoadValidStringNoSuppress(): void |
| 54 | + public function xtestLoadValidStringNoSuppress(): void |
50 | 55 | { |
51 | 56 | $libxml = libxml_use_internal_errors(); |
52 | 57 | $html = '<table>'; |
53 | 58 | $reader = new Html(); |
54 | | - $this->spreadsheet = $reader->loadFromString($html); |
| 59 | + $spreadsheet = $reader->loadFromString($html); |
55 | 60 | self::assertEmpty($reader->getLibxmlMessages()); |
56 | 61 | self::assertSame($libxml, libxml_use_internal_errors()); |
| 62 | + $spreadsheet->disconnectWorksheets(); |
57 | 63 | } |
58 | 64 |
|
59 | | - public function testLoadValidFile(): void |
| 65 | + public function xtestLoadValidFile(): void |
60 | 66 | { |
61 | 67 | $libxml = libxml_use_internal_errors(); |
62 | 68 | $reader = new Html(); |
63 | 69 | $reader->setSuppressLoadWarnings(true); |
64 | 70 | $file = 'tests/data/Reader/HTML/charset.ISO-8859-1.html4.html'; |
65 | | - $this->spreadsheet = $reader->load($file); |
| 71 | + $spreadsheet = $reader->load($file); |
66 | 72 | self::assertEmpty($reader->getLibxmlMessages()); |
67 | 73 | self::assertSame($libxml, libxml_use_internal_errors()); |
| 74 | + $spreadsheet->disconnectWorksheets(); |
68 | 75 | } |
69 | 76 |
|
70 | | - public function testLoadInvalidFile(): void |
| 77 | + public function xtestLoadInvalidFile(): void |
71 | 78 | { |
72 | 79 | $libxml = libxml_use_internal_errors(); |
73 | 80 | $reader = new Html(); |
74 | 81 | $reader->setSuppressLoadWarnings(true); |
75 | 82 | $file = 'tests/data/Reader/HTML/badhtml.html'; |
76 | | - $this->spreadsheet = $reader->load($file); |
| 83 | + $spreadsheet = $reader->load($file); |
77 | 84 | self::assertNotEmpty($reader->getLibxmlMessages()); |
78 | 85 | self::assertSame($libxml, libxml_use_internal_errors()); |
| 86 | + $spreadsheet->disconnectWorksheets(); |
79 | 87 | } |
80 | 88 | } |
0 commit comments