Ticket #26222: 26222.diff
| File 26222.diff, 3.1 KB (added by , 12 years ago) |
|---|
-
tests/phpunit/tests/formatting/balanceTags.php
7 7 8 8 function nestable_tags() { 9 9 return array( 10 array( 'blockquote' , 'div', 'object', 'q', 'span' )10 array( 'blockquote' ), array( 'div' ), array( 'object' ), array( 'q' ), array( 'span' ), 11 11 ); 12 12 } 13 13 … … 20 20 ); 21 21 } 22 22 23 // These are single/self-closing tags that WP has traditionally recognized.24 function basic_single_tags() {25 return array(26 array( 'br' ), array( 'hr' ), array( 'img' ), array( 'input' )27 );28 }29 30 23 /** 31 * These are single tags WP has traditionally properly handled32 * This test can be removed if #1597 is fixed and the next test passes, as33 * it supercedes this test.34 *35 * @dataProvider basic_single_tags36 */37 function test_selfcloses_unclosed_basic_known_single_tags( $tag ) {38 $this->assertEquals( "<$tag />", balanceTags( "<$tag>", true ) );39 }40 41 /**42 24 * If a recognized valid single tag appears unclosed, it should get self-closed 43 25 * 44 * @ticket 159745 26 * @dataProvider single_tags 46 27 */ 47 28 function test_selfcloses_unclosed_known_single_tags( $tag ) { … … 49 30 } 50 31 51 32 /** 52 * These are single tags WP has traditionally properly handled53 * This test can be removed if #1597 is fixed and the next test passes, as54 * it supercedes this test.55 *56 * @dataProvider basic_single_tags57 */58 function test_selfcloses_basic_known_single_tags_having_closing_tag( $tag ) {59 $this->assertEquals( "<$tag />", balanceTags( "<$tag></$tag>", true ) );60 }61 62 /**63 33 * If a recognized valid single tag is given a closing tag, the closing tag 64 34 * should get removed and tag should be self-closed. 65 35 * 66 * @ticket 159767 36 * @dataProvider single_tags 68 37 */ 69 38 function test_selfcloses_known_single_tags_having_closing_tag( $tag ) { 70 39 $this->assertEquals( "<$tag />", balanceTags( "<$tag></$tag>", true ) ); 71 40 } 72 41 73 /**74 * @ticket 159775 */76 42 function test_closes_unknown_single_tags_with_closing_tag() { 77 43 78 44 $inputs = array( … … 121 87 } 122 88 } 123 89 124 function test_balances_nestable_tags() { 90 /** 91 * @dataProvider nestable_tags 92 */ 93 function test_balances_nestable_tags( $tag ) { 125 94 $inputs = array( 126 '<q>Test<q>Test</q>',127 '<div><div>Test',128 '<div>Test</div></div>',95 "<$tag>Test<$tag>Test</$tag>", 96 "<$tag><$tag>Test", 97 "<$tag>Test</$tag></$tag>", 129 98 ); 130 99 $expected = array( 131 '<q>Test<q>Test</q></q>',132 '<div><div>Test</div></div>',133 '<div>Test</div>',100 "<$tag>Test<$tag>Test</$tag></$tag>", 101 "<$tag><$tag>Test</$tag></$tag>", 102 "<$tag>Test</$tag>", 134 103 ); 135 104 136 105 foreach ( $inputs as $key => $input ) { … … 152 121 } 153 122 } 154 123 155 /**156 * @ticket 20401157 */158 124 function test_allows_immediately_nested_object_tags() { 159 160 125 $object = '<object id="obj1"><param name="param1"/><object id="obj2"><param name="param2"/></object></object>'; 161 126 $this->assertEquals( $object, balanceTags( $object, true ) ); 162 127 }