@@ -56,18 +56,26 @@ public function test_shortcode_returns_string() {
5656 */
5757 public function test_build_query_args_defaults () {
5858 $ args = RandomPostOnRefresh::build_query_args ( RandomPostOnRefresh::DEFAULT_ATTRIBUTES );
59- $ this ->assertEquals ( '' , $ args ['author ' ], 'author should be empty ' );
60- $ this ->assertEquals ( '' , $ args ['class ' ], 'class should be empty ' );
61- $ this ->assertEquals ( '' , $ args ['ids ' ], 'ids should be empty ' );
59+ // Author
60+ $ this ->assertArrayNotHasKey ( 'author__in ' , $ args );
61+ // IDs
62+ $ this ->assertArrayNotHasKey ( 'post__in ' , $ args );
63+ // Not
64+ $ this ->assertArrayHasKey ( 'post__not_in ' , $ args ); // This should always be set
65+ // Post type
66+ $ this ->assertEquals ( array ( 'post ' ), $ args ['post_type ' ] );
67+ // Posts per page
68+ $ this ->assertEquals ( 100 , $ args ['posts_per_page ' ] );
69+ // Search
70+ $ this ->assertArrayNotHasKey ( 's ' , $ args );
71+ // Show
6272 $ this ->assertArrayHasKey ( 'meta_query ' , $ args );
6373 $ this ->assertArrayHasKey ( 'key ' , $ args ['meta_query ' ][0 ] );
6474 $ this ->assertEquals ( '_thumbnail_id ' , $ args ['meta_query ' ][0 ]['key ' ] );
65- $ this ->assertEquals ( '' , $ args ['not ' ], 'not should be empty ' );
66- $ this ->assertEquals ( array ( 'post ' ), $ args ['post_type ' ], 'post_type should be post ' );
67- $ this ->assertEquals ( 100 , $ args ['posts_per_page ' ], 'posts_per_page should be 100 ' );
68- $ this ->assertEquals ( '' , $ args ['search ' ], 'search should be empty ' );
69- $ this ->assertEquals ( '' , $ args ['taxonomy ' ], 'taxonomy should be empty ' );
70- $ this ->assertEquals ( '' , $ args ['terms ' ], 'terms should be empty ' );
75+ // Taxonomy / Terms
76+ $ this ->assertArrayNotHasKey ( 'category__in ' , $ args );
77+ $ this ->assertArrayNotHasKey ( 'tag__in ' , $ args );
78+ $ this ->assertArrayNotHasKey ( 'tax_query ' , $ args );
7179 }
7280
7381 /**
0 commit comments