Changeset 59812
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-tag-processor.php
r59464 r59812 2550 2550 ); 2551 2551 return false; 2552 } 2553 2554 $existing_bookmark = $this->bookmarks[ $bookmark_name ]; 2555 2556 if ( 2557 $this->token_starts_at === $existing_bookmark->start && 2558 $this->token_length === $existing_bookmark->length 2559 ) { 2560 return true; 2552 2561 } 2553 2562 -
trunk/tests/phpunit/tests/html-api/wpHtmlTagProcessor-bookmark.php
r58048 r59812 436 436 $processor = new WP_HTML_Tag_Processor( '<ul><li>One</li><li>Two</li><li>Three</li></ul>' ); 437 437 $processor->next_tag( 'li' ); 438 $processor->set_bookmark( 'bookmark' ); 439 440 for ( $i = 0; $i < WP_HTML_Tag_Processor::MAX_SEEK_OPS; $i++ ) { 441 $this->assertTrue( $processor->seek( 'bookmark' ), 'Could not seek to the "bookmark"' ); 438 $processor->set_bookmark( 'ping' ); 439 $processor->next_tag( 'li' ); 440 $processor->set_bookmark( 'pong' ); 441 442 for ( $i = 0; $i < WP_HTML_Tag_Processor::MAX_SEEK_OPS; $i += 2 ) { 443 $this->assertTrue( 444 $processor->seek( 'ping' ), 445 'Could not seek to the "ping": check test setup.' 446 ); 447 448 $this->assertTrue( 449 $processor->seek( 'pong' ), 450 'Could not seek to the "pong": check test setup.' 451 ); 442 452 } 443 453 444 454 $this->setExpectedIncorrectUsage( 'WP_HTML_Tag_Processor::seek' ); 445 455 $this->assertFalse( $processor->seek( 'bookmark' ), "$i-th seek() to the bookmark succeeded, even though it should exceed the allowed limit" ); 456 } 457 458 /** 459 * @ticket 62085 460 * 461 * @covers WP_HTML_Tag_Processor::seek 462 */ 463 public function test_skips_counting_noop_seek_calls() { 464 $processor = new WP_HTML_Tag_Processor( '<ul><li>One</li><li>Two</li><li>Three</li></ul>' ); 465 $processor->next_tag( 'li' ); 466 $processor->set_bookmark( 'here' ); 467 468 for ( $i = 0; $i < WP_HTML_Tag_Processor::MAX_SEEK_OPS; $i++ ) { 469 $this->assertTrue( 470 $processor->seek( 'here' ), 471 'Could not seek to the "here": check test setup.' 472 ); 473 } 474 475 $this->assertTrue( 476 $processor->seek( 'here' ), 477 'Should never fail to seek if the seek is pointing at the current location.' 478 ); 446 479 } 447 480
Note: See TracChangeset
for help on using the changeset viewer.