-
-
Save peterwilsoncc/58502f06dc6df114aca00f74d6035927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Tests_TheseAllFail extends WP_UnitTestCase { | |
| public function test_query_var_getter_returns_as_passed( $query_var, $query_var_value ) { | |
| // $this->markTestSkipped(); | |
| $query = new WP_Query(); | |
| $query->parse_query( | |
| array( | |
| $query_var => $query_var_value, | |
| ) | |
| ); | |
| $this->assertSame( $query_var_value, $query->get( $query_var ), 'Query variable getter should type and order in which it was passed' ); | |
| } | |
| public function data_query_var_getter_returns_as_passed() { | |
| return array( | |
| 'post_id string' => array( 'p', '1' ), | |
| 'page_id string' => array( 'page_id', '1' ), | |
| 'post_type null' => array( 'post_type', null ), | |
| 'cat string[]' => array( 'cat', array( '1', '2' ) ), | |
| 'cat int' => array( 'cat', 1 ), | |
| 'tag string[]' => array( 'tag', array( '1', '2' ) ), | |
| 'tag int' => array( 'tag', 1 ), | |
| 'category__in string[]' => array( 'category__in', array( '1', '2' ) ), | |
| 'category__in int[] dupe' => array( 'category__in', array( 1, 1, 2, 2 ) ), | |
| 'category__not_in string[]' => array( 'category__not_in', array( '1', '2' ) ), | |
| 'category__not_in int[] dupe' => array( 'category__not_in', array( 1, 1, 2, 2 ) ), | |
| 'category__and string[]' => array( 'category__and', array( '1', '2' ) ), | |
| 'category__and int[] dupe' => array( 'category__and', array( 1, 1, 2, 2 ) ), | |
| 'tag_id string[]' => array( 'tag_id', '1' ), | |
| 'tag__in string[]' => array( 'tag__in', array( '1', '2' ) ), | |
| 'tag__in int[] dupe' => array( 'tag__in', array( 1, 1, 2, 2 ) ), | |
| 'tag__not_in string[]' => array( 'tag__not_in', array( '1', '2' ) ), | |
| 'tag__not_in int[] dupe' => array( 'tag__not_in', array( 1, 1, 2, 2 ) ), | |
| 'tag__and string[]' => array( 'tag__and', array( '1', '2' ) ), | |
| 'tag__and int[] dupe' => array( 'tag__and', array( 1, 1, 2, 2 ) ), | |
| 'tag_slug__in dupe' => array( 'tag_slug__in', array( 'pwcc', 'pwcc' ) ), | |
| 'tag_slug__and dupe' => array( 'tag_slug__and', array( 'joe', 'joe', 'zepp' ) ), | |
| // Not a big deal. | |
| 'ignore_sticky_posts null' => array( 'ignore_sticky_posts', null ), // ! isset() | |
| 'cache_results null' => array( 'cache_results', null ), // ! isset() | |
| 'update_post_term_cache null' => array( 'update_post_term_cache', null ), // ! isset() | |
| 'lazy_load_term_meta null' => array( 'lazy_load_term_meta', null ), // ! isset() | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment