Skip to content

Commit 785ce30

Browse files
committed
Add test for defaults
1 parent a972526 commit 785ce30

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/RandomPostOnRefreshTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,25 @@ public function test_shortcode_returns_string() {
5151
$this->assertIsString( $output );
5252
}
5353

54+
/**
55+
* Test build_query_args with default attributes.
56+
*/
57+
public function test_build_query_args_defaults() {
58+
$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' );
62+
$this->assertArrayHasKey( 'meta_query', $args );
63+
$this->assertArrayHasKey( 'key', $args['meta_query'][0] );
64+
$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' );
71+
}
72+
5473
/**
5574
* Test build_query_args with minimal attributes.
5675
*/

0 commit comments

Comments
 (0)