Skip to content

Commit eb30dbf

Browse files
committed
Fix test for checking output from defaults
1 parent c87f064 commit eb30dbf

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

tests/RandomPostOnRefreshTest.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)