Changeset 53396
- Timestamp:
- 05/15/2022 03:55:11 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/conditionals.php
r53395 r53396 1619 1619 /** 1620 1620 * @ticket 55104 1621 * @expectedIncorrectUsage is_main_query 1622 */ 1623 public function test_is_main_query_returns_false_if_wp_query_is_not_set() { 1621 */ 1622 public function test_conditional_tags_trigger_doing_it_wrong_and_return_false_if_wp_query_is_not_set() { 1624 1623 unset( $GLOBALS['wp_query'] ); 1625 1624 1626 $this->assertFalse( is_main_query() ); 1625 $functions = get_class_methods( 'WP_Query' ); 1626 1627 foreach ( $functions as $function_name ) { 1628 // Only test `is_*()` conditional tags. 1629 if ( ! str_starts_with( $function_name, 'is_' ) ) { 1630 continue; 1631 } 1632 1633 if ( 'is_comments_popup' === $function_name ) { 1634 // `is_comments_popup()` is deprecated as of WP 4.5. 1635 $this->setExpectedDeprecated( $function_name ); 1636 } else { 1637 // All the other functions should throw a `_doing_it_wrong()` notice. 1638 $this->setExpectedIncorrectUsage( $function_name ); 1639 } 1640 1641 $this->assertFalse( call_user_func( $function_name ) ); 1642 } 1627 1643 } 1628 1644
Note: See TracChangeset
for help on using the changeset viewer.