@@ -87,12 +87,15 @@ public function test_build_query_args_minimal() {
8787 * Test build_query_args with author, ids, not, and search.
8888 */
8989 public function test_build_query_args_with_filters () {
90- $ atts = array (
91- 'post_type ' => 'post ' ,
92- 'author ' => '1,2 ' ,
93- 'ids ' => '10,20 ' ,
94- 'not ' => '5,6 ' ,
95- 'search ' => 'test ' ,
90+ $ atts = array_merge (
91+ RandomPostOnRefresh::DEFAULT_ATTRIBUTES ,
92+ array (
93+ 'post_type ' => 'post ' ,
94+ 'author ' => '1,2 ' ,
95+ 'ids ' => '10,20 ' ,
96+ 'not ' => '5,6 ' ,
97+ 'search ' => 'test ' ,
98+ )
9699 );
97100 $ args = RandomPostOnRefresh::build_query_args ( $ atts );
98101 $ this ->assertEquals ( array ( 1 , 2 ), $ args ['author__in ' ] );
@@ -105,10 +108,13 @@ public function test_build_query_args_with_filters() {
105108 * Test build_query_args with taxonomy and terms.
106109 */
107110 public function test_build_query_args_with_taxonomy () {
108- $ atts = array (
109- 'post_type ' => 'post ' ,
110- 'taxonomy ' => 'category ' ,
111- 'terms ' => '3,4 ' ,
111+ $ atts = array_merge (
112+ RandomPostOnRefresh::DEFAULT_ATTRIBUTES ,
113+ array (
114+ 'post_type ' => 'post ' ,
115+ 'taxonomy ' => 'category ' ,
116+ 'terms ' => '3,4 ' ,
117+ )
112118 );
113119 $ args = RandomPostOnRefresh::build_query_args ( $ atts );
114120 $ this ->assertEquals ( array ( 3 , 4 ), $ args ['category__in ' ] );
@@ -118,10 +124,13 @@ public function test_build_query_args_with_taxonomy() {
118124 * Test build_query_args with show=image and image_required=true.
119125 */
120126 public function test_build_query_args_with_image_required () {
121- $ atts = array (
122- 'post_type ' => 'post ' ,
123- 'show ' => 'title, image ' ,
124- 'image_required ' => 'true ' ,
127+ $ atts = array_merge (
128+ RandomPostOnRefresh::DEFAULT_ATTRIBUTES ,
129+ array (
130+ 'post_type ' => 'post ' ,
131+ 'show ' => 'title, image ' ,
132+ 'image_required ' => 'true ' ,
133+ )
125134 );
126135 $ args = RandomPostOnRefresh::build_query_args ( $ atts );
127136 $ this ->assertArrayHasKey ( 'meta_query ' , $ args );
0 commit comments