- Timestamp:
- 03/06/2023 06:53:38 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
r55315 r55469 431 431 /** 432 432 * @ticket 56299 433 * @ticket 57852 433 434 * 434 435 * @covers WP_HTML_Tag_Processor::next_tag … … 460 461 ); 461 462 $this->assertTrue( $p->is_tag_closer(), 'Indicated a tag closer is a tag opener' ); 463 464 $p = new WP_HTML_Tag_Processor( '<div>' ); 465 $this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), "Did not find a tag opener when tag_closers was set to 'visit'" ); 466 $this->assertFalse( $p->next_tag( array( 'tag_closers' => 'visit' ) ), "Found a closer where there wasn't one" ); 467 } 468 469 /** 470 * @ticket 57852 471 * 472 * @covers WP_HTML_Tag_Processor::next_tag 473 * @covers WP_HTML_Tag_Processor::is_tag_closer 474 */ 475 public function test_next_tag_should_stop_on_rcdata_and_script_tag_closers_when_requested() { 476 $p = new WP_HTML_Tag_Processor( '<script>abc</script>' ); 477 478 $p->next_tag(); 479 $this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </script> tag closer' ); 480 $this->assertTrue( $p->is_tag_closer(), 'Indicated a <script> tag opener is a tag closer' ); 481 482 $p = new WP_HTML_Tag_Processor( 'abc</script>' ); 483 $this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </script> tag closer when there was no tag opener' ); 484 485 $p = new WP_HTML_Tag_Processor( '<textarea>abc</textarea>' ); 486 487 $p->next_tag(); 488 $this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </textarea> tag closer' ); 489 $this->assertTrue( $p->is_tag_closer(), 'Indicated a <textarea> tag opener is a tag closer' ); 490 491 $p = new WP_HTML_Tag_Processor( 'abc</textarea>' ); 492 $this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </textarea> tag closer when there was no tag opener' ); 493 494 $p = new WP_HTML_Tag_Processor( '<title>abc</title>' ); 495 496 $p->next_tag(); 497 $this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </title> tag closer' ); 498 $this->assertTrue( $p->is_tag_closer(), 'Indicated a <title> tag opener is a tag closer' ); 499 500 $p = new WP_HTML_Tag_Processor( 'abc</title>' ); 501 $this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </title> tag closer when there was no tag opener' ); 462 502 } 463 503
Note: See TracChangeset
for help on using the changeset viewer.