PSR-2 reformatting PHPDoc corrections
[htmlpurifier.git] / tests / HTMLPurifier / ChildDef / TableTest.php
blob61027e712948f8c17b82f9e34be3e0dfc583c596
1 <?php
3 // we're using empty tags to compact the tests: under real circumstances
4 // there would be contents in them
6 class HTMLPurifier_ChildDef_TableTest extends HTMLPurifier_ChildDefHarness
9 public function setUp()
11 parent::setUp();
12 $this->obj = new HTMLPurifier_ChildDef_Table();
15 public function testEmptyInput()
17 $this->assertResult('', false);
20 public function testSingleRow()
22 $this->assertResult('<tr />');
25 public function testComplexContents()
27 $this->assertResult('<caption /><col /><thead /><tfoot /><tbody>'.
28 '<tr><td>asdf</td></tr></tbody>');
29 $this->assertResult('<col /><col /><col /><tr />');
32 public function testReorderContents()
34 $this->assertResult(
35 '<col /><colgroup /><tbody /><tfoot /><thead /><tr>1</tr><caption /><tr />',
36 '<caption /><col /><colgroup /><thead /><tfoot /><tbody /><tbody><tr>1</tr><tr /></tbody>');
39 public function testXhtml11Illegal()
41 $this->assertResult(
42 '<thead><tr><th>a</th></tr></thead><tr><td>a</td></tr>',
43 '<thead><tr><th>a</th></tr></thead><tbody><tr><td>a</td></tr></tbody>'
47 public function testTrOverflowAndClose()
49 $this->assertResult(
50 '<tr><td>a</td></tr><tr><td>b</td></tr><tbody><tr><td>c</td></tr></tbody><tr><td>d</td></tr>',
51 '<tbody><tr><td>a</td></tr><tr><td>b</td></tr></tbody><tbody><tr><td>c</td></tr></tbody><tbody><tr><td>d</td></tr></tbody>'
55 public function testDuplicateProcessing()
57 $this->assertResult(
58 '<caption>1</caption><caption /><tbody /><tbody /><tfoot>1</tfoot><tfoot />',
59 '<caption>1</caption><tfoot>1</tfoot><tbody /><tbody /><tbody />'
63 public function testRemoveText()
65 $this->assertResult('foo', false);
68 public function testStickyWhitespaceOnTr()
70 $this->config->set('Output.Newline', "\n");
71 $this->assertResult("\n <tr />\n <tr />\n ");
74 public function testStickyWhitespaceOnTSection()
76 $this->config->set('Output.Newline', "\n");
77 $this->assertResult(
78 "\n\t<tbody />\n\t\t<tfoot />\n\t\t\t",
79 "\n\t\t<tfoot />\n\t<tbody />\n\t\t\t"
86 // vim: et sw=4 sts=4