Changeset 51461
- Timestamp:
- 07/19/2021 01:29:45 PM (4 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r51451 r51461 391 391 392 392 /** 393 * Asserts that a string haystack does not contain a needle.393 * Asserts that a string haystack contains a needle (case-insensitive). 394 394 * 395 395 * This method has been backported from a more recent PHPUnit version, … … 402 402 * @param string $message Optional. Message to display when the assertion fails. 403 403 */ 404 public static function assertStringContainsStringIgnoringCase( $needle, $haystack, $message = '' ) { 405 static::assertContains( $needle, $haystack, $message, true ); 406 } 407 408 /** 409 * Asserts that a string haystack does not contain a needle. 410 * 411 * This method has been backported from a more recent PHPUnit version, 412 * as tests running on PHP 5.6 use PHPUnit 5.7.x. 413 * 414 * @since 5.9.0 415 * 416 * @param string $needle The string to search for. 417 * @param string $haystack The string to treat as the haystack. 418 * @param string $message Optional. Message to display when the assertion fails. 419 */ 404 420 public static function assertStringNotContainsString( $needle, $haystack, $message = '' ) { 405 421 static::assertNotContains( $needle, $haystack, $message ); 406 422 } 423 424 /** 425 * Asserts that a string haystack does not contain a needle (case-insensitive). 426 * 427 * This method has been backported from a more recent PHPUnit version, 428 * as tests running on PHP 5.6 use PHPUnit 5.7.x. 429 * 430 * @since 5.9.0 431 * 432 * @param string $needle The string to search for. 433 * @param string $haystack The string to treat as the haystack. 434 * @param string $message Optional. Message to display when the assertion fails. 435 */ 436 public static function assertStringNotContainsStringIgnoringCase( $needle, $haystack, $message = '' ) { 437 static::assertNotContains( $needle, $haystack, $message, true ); 438 } 407 439 } -
trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php
r51404 r51461 627 627 rest_url( 'wp/v2/categories' ) 628 628 ); 629 $this->assert False( stripos( $headers['Link'], 'rel="prev"' ));629 $this->assertStringNotContainsString( 'rel="prev"', $headers['Link'] ); 630 630 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); 631 631 … … 671 671 ); 672 672 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 673 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));673 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 674 674 675 675 // Out of bounds. … … 688 688 ); 689 689 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 690 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));690 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 691 691 } 692 692 -
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r51404 r51461 822 822 rest_url( '/wp/v2/comments' ) 823 823 ); 824 $this->assert False( stripos( $headers['Link'], 'rel="prev"' ));824 $this->assertStringNotContainsString( 'rel="prev"', $headers['Link'] ); 825 825 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); 826 826 … … 868 868 ); 869 869 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 870 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));870 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 871 871 872 872 // Out of bounds. … … 884 884 ); 885 885 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 886 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));886 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 887 887 } 888 888 -
trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php
r51208 r51461 177 177 $search_field_values = $pattern['title'] . ' ' . $pattern['description']; 178 178 179 $this->assert NotFalse( stripos( $search_field_values, $search_term ));179 $this->assertStringContainsStringIgnoringCase( $search_term, $search_field_values ); 180 180 } 181 181 } -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r51405 r51461 1532 1532 rest_url( '/wp/v2/posts' ) 1533 1533 ); 1534 $this->assert False( stripos( $headers['Link'], 'rel="prev"' ));1534 $this->assertStringNotContainsString( 'rel="prev"', $headers['Link'] ); 1535 1535 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); 1536 1536 … … 1574 1574 ); 1575 1575 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 1576 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));1576 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 1577 1577 1578 1578 // Out of bounds. -
trunk/tests/phpunit/tests/rest-api/rest-revisions-controller.php
r51367 r51461 483 483 rest_url( $rest_route ) 484 484 ); 485 $this->assert False( stripos( $headers['Link'], 'rel="prev"' ));485 $this->assertStringNotContainsString( 'rel="prev"', $headers['Link'] ); 486 486 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); 487 487 } -
trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php
r51404 r51461 591 591 rest_url( 'wp/v2/tags' ) 592 592 ); 593 $this->assert False( stripos( $headers['Link'], 'rel="prev"' ));593 $this->assertStringNotContainsString( 'rel="prev"', $headers['Link'] ); 594 594 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); 595 595 … … 633 633 ); 634 634 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 635 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));635 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 636 636 637 637 // Out of bounds. … … 649 649 ); 650 650 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 651 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));651 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 652 652 } 653 653 -
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r51404 r51461 322 322 rest_url( 'wp/v2/users' ) 323 323 ); 324 $this->assert False( stripos( $headers['Link'], 'rel="prev"' ));324 $this->assertStringNotContainsString( 'rel="prev"', $headers['Link'] ); 325 325 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); 326 326 … … 364 364 ); 365 365 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 366 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));366 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 367 367 368 368 // Out of bounds. … … 380 380 ); 381 381 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); 382 $this->assert False( stripos( $headers['Link'], 'rel="next"' ));382 $this->assertStringNotContainsString( 'rel="next"', $headers['Link'] ); 383 383 } 384 384
Note: See TracChangeset
for help on using the changeset viewer.