Changeset 52010 for trunk/tests/phpunit/tests/formatting/balanceTags.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/balanceTags.php
r50000 r52010 6 6 class Tests_Formatting_BalanceTags extends WP_UnitTestCase { 7 7 8 function nestable_tags() {8 public function nestable_tags() { 9 9 return array( 10 10 array( 'blockquote' ), … … 17 17 18 18 // This is a complete(?) listing of valid single/self-closing tags. 19 function single_tags() {19 public function single_tags() { 20 20 return array( 21 21 array( 'area' ), … … 38 38 } 39 39 40 function supported_traditional_tag_names() {40 public function supported_traditional_tag_names() { 41 41 return array( 42 42 array( 'a' ), … … 50 50 } 51 51 52 function supported_custom_element_tag_names() {52 public function supported_custom_element_tag_names() { 53 53 return array( 54 54 array( 'custom-element' ), … … 62 62 } 63 63 64 function invalid_tag_names() {64 public function invalid_tag_names() { 65 65 return array( 66 66 array( '<0-day>inside', '<0-day>inside' ), // Can't start with a number - handled by the "<3" fix. … … 74 74 * @see https://w3c.github.io/webcomponents/spec/custom/#valid-custom-element-name 75 75 */ 76 function unsupported_valid_tag_names() {76 public function unsupported_valid_tag_names() { 77 77 return array( 78 78 // We don't allow ending in a dash. … … 134 134 * @see https://w3c.github.io/webcomponents/spec/custom/#valid-custom-element-name 135 135 */ 136 function supported_invalid_tag_names() {136 public function supported_invalid_tag_names() { 137 137 return array( 138 138 // Reserved names for custom elements. … … 152 152 * @dataProvider supported_traditional_tag_names 153 153 */ 154 function test_detects_traditional_tag_names( $tag ) {154 public function test_detects_traditional_tag_names( $tag ) { 155 155 $normalized = strtolower( $tag ); 156 156 … … 162 162 * @dataProvider supported_custom_element_tag_names 163 163 */ 164 function test_detects_supported_custom_element_tag_names( $tag ) {164 public function test_detects_supported_custom_element_tag_names( $tag ) { 165 165 $this->assertSame( "<$tag>inside</$tag>", balanceTags( "<$tag>inside", true ) ); 166 166 } … … 170 170 * @dataProvider invalid_tag_names 171 171 */ 172 function test_ignores_invalid_tag_names( $input, $output ) {172 public function test_ignores_invalid_tag_names( $input, $output ) { 173 173 $this->assertSame( $output, balanceTags( $input, true ) ); 174 174 } … … 178 178 * @dataProvider unsupported_valid_tag_names 179 179 */ 180 function test_ignores_unsupported_custom_tag_names( $tag ) {180 public function test_ignores_unsupported_custom_tag_names( $tag ) { 181 181 $this->assertSame( "<$tag>inside", balanceTags( "<$tag>inside", true ) ); 182 182 } … … 186 186 * @dataProvider supported_invalid_tag_names 187 187 */ 188 function test_detects_supported_invalid_tag_names( $tag ) {188 public function test_detects_supported_invalid_tag_names( $tag ) { 189 189 $this->assertSame( "<$tag>inside</$tag>", balanceTags( "<$tag>inside", true ) ); 190 190 } … … 196 196 * @dataProvider single_tags 197 197 */ 198 function test_selfcloses_unclosed_known_single_tags( $tag ) {198 public function test_selfcloses_unclosed_known_single_tags( $tag ) { 199 199 $this->assertSame( "<$tag />", balanceTags( "<$tag>", true ) ); 200 200 } … … 207 207 * @dataProvider single_tags 208 208 */ 209 function test_selfcloses_known_single_tags_having_closing_tag( $tag ) {209 public function test_selfcloses_known_single_tags_having_closing_tag( $tag ) { 210 210 $this->assertSame( "<$tag />", balanceTags( "<$tag></$tag>", true ) ); 211 211 } … … 214 214 * @ticket 1597 215 215 */ 216 function test_closes_unknown_single_tags_with_closing_tag() {216 public function test_closes_unknown_single_tags_with_closing_tag() { 217 217 218 218 $inputs = array( … … 237 237 } 238 238 239 function test_closes_unclosed_single_tags_having_attributes() {239 public function test_closes_unclosed_single_tags_having_attributes() { 240 240 $inputs = array( 241 241 '<img src="/images/example.png">', … … 252 252 } 253 253 254 function test_allows_validly_closed_single_tags() {254 public function test_allows_validly_closed_single_tags() { 255 255 $inputs = array( 256 256 '<br />', … … 268 268 * @dataProvider nestable_tags 269 269 */ 270 function test_balances_nestable_tags( $tag ) {270 public function test_balances_nestable_tags( $tag ) { 271 271 $inputs = array( 272 272 "<$tag>Test<$tag>Test</$tag>", … … 285 285 } 286 286 287 function test_allows_adjacent_nestable_tags() {287 public function test_allows_adjacent_nestable_tags() { 288 288 $inputs = array( 289 289 '<blockquote><blockquote>Example quote</blockquote></blockquote>', … … 302 302 * @ticket 20401 303 303 */ 304 function test_allows_immediately_nested_object_tags() {304 public function test_allows_immediately_nested_object_tags() { 305 305 $object = '<object id="obj1"><param name="param1"/><object id="obj2"><param name="param2"/></object></object>'; 306 306 $this->assertSame( $object, balanceTags( $object, true ) ); 307 307 } 308 308 309 function test_balances_nested_non_nestable_tags() {309 public function test_balances_nested_non_nestable_tags() { 310 310 $inputs = array( 311 311 '<b><b>This is bold</b></b>', … … 322 322 } 323 323 324 function test_fixes_improper_closing_tag_sequence() {324 public function test_fixes_improper_closing_tag_sequence() { 325 325 $inputs = array( 326 326 '<p>Here is a <strong class="part">bold <em>and emphasis</p></em></strong>', … … 337 337 } 338 338 339 function test_adds_missing_closing_tags() {339 public function test_adds_missing_closing_tags() { 340 340 $inputs = array( 341 341 '<b><i>Test</b>', … … 358 358 } 359 359 360 function test_removes_extraneous_closing_tags() {360 public function test_removes_extraneous_closing_tags() { 361 361 $inputs = array( 362 362 '<b>Test</b></b>',
Note: See TracChangeset
for help on using the changeset viewer.