Changeset 53429 for trunk/tests/phpunit/tests/query/conditionals.php
- Timestamp:
- 05/22/2022 03:15:47 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/conditionals.php
r53400 r53429 1661 1661 } 1662 1662 1663 /** 1664 * @ticket 55722 1665 * 1666 * @dataProvider data_loop_functions_do_not_trigger_a_fatal_error_if_wp_query_is_not_set 1667 * 1668 * @param string $function_name The name of the function to test. 1669 * @param false|null $expected Expected return value. 1670 */ 1671 public function test_loop_functions_do_not_trigger_a_fatal_error_if_wp_query_is_not_set( $function_name, $expected ) { 1672 unset( $GLOBALS['wp_query'] ); 1673 1674 $this->assertSame( $expected, call_user_func( $function_name ) ); 1675 } 1676 1677 /** 1678 * Data provider. 1679 * 1680 * @return array[] Test parameters { 1681 * @type string $function_name The name of the function to test. 1682 * @type false|null $expected Expected return value. 1683 * } 1684 */ 1685 public function data_loop_functions_do_not_trigger_a_fatal_error_if_wp_query_is_not_set() { 1686 return array( 1687 array( 'have_posts', false ), 1688 array( 'in_the_loop', false ), 1689 array( 'rewind_posts', null ), 1690 array( 'the_post', null ), 1691 array( 'have_comments', false ), 1692 array( 'the_comment', null ), 1693 ); 1694 } 1695 1663 1696 }
Note: See TracChangeset
for help on using the changeset viewer.