Skip to content

Commit 57dc098

Browse files
committed
Fix code style issues found by phpcs
- Auto-fix array double arrow alignment in all test files - Fix multi-line array formatting in Include_Posts_Tests.php and Tax_Query_Tests.php - Remove empty if statement check for filter_var in bootstrap.php - All 134 tests still passing - All phpcs checks now passing
1 parent 12c0d2c commit 57dc098

9 files changed

+92
-78
lines changed

tests/unit/Disable_Pagination_Tests.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Disable_Pagination_Tests extends TestCase {
2020
*/
2121
public function data_no_pagination_setting() {
2222
return array(
23-
'no disable_pagination param' => array(
23+
'no disable_pagination param' => array(
2424
// Custom data.
2525
array(),
2626
// Expected.
@@ -34,15 +34,15 @@ public function data_no_pagination_setting() {
3434
// Expected - empty string is falsy, not processed.
3535
array( 'is_aql' => true ),
3636
),
37-
'null disable_pagination' => array(
37+
'null disable_pagination' => array(
3838
// Custom data.
3939
array(
4040
'disable_pagination' => null,
4141
),
4242
// Expected - null is falsy, not processed.
4343
array( 'is_aql' => true ),
4444
),
45-
'false disable_pagination' => array(
45+
'false disable_pagination' => array(
4646
// Custom data.
4747
array(
4848
'disable_pagination' => false,
@@ -75,7 +75,7 @@ public function test_disable_pagination_empty_handling( $custom_data, $expected
7575
*/
7676
public function data_disable_pagination_enabled() {
7777
return array(
78-
'boolean true' => array(
78+
'boolean true' => array(
7979
// Custom data.
8080
array(
8181
'disable_pagination' => true,
@@ -86,7 +86,7 @@ public function data_disable_pagination_enabled() {
8686
'no_found_rows' => true,
8787
),
8888
),
89-
'integer 1' => array(
89+
'integer 1' => array(
9090
// Custom data.
9191
array(
9292
'disable_pagination' => 1,
@@ -108,7 +108,7 @@ public function data_disable_pagination_enabled() {
108108
'no_found_rows' => 'true',
109109
),
110110
),
111-
'string "1"' => array(
111+
'string "1"' => array(
112112
// Custom data.
113113
array(
114114
'disable_pagination' => '1',

tests/unit/Enable_Caching_Tests.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Enable_Caching_Tests extends TestCase {
2020
*/
2121
public function data_no_caching_setting() {
2222
return array(
23-
'no enable_caching param' => array(
23+
'no enable_caching param' => array(
2424
// Custom data.
2525
array(),
2626
// Expected.
@@ -34,23 +34,23 @@ public function data_no_caching_setting() {
3434
// Expected - empty string is falsy, not processed.
3535
array( 'is_aql' => true ),
3636
),
37-
'null enable_caching' => array(
37+
'null enable_caching' => array(
3838
// Custom data.
3939
array(
4040
'enable_caching' => null,
4141
),
4242
// Expected - null is falsy, not processed.
4343
array( 'is_aql' => true ),
4444
),
45-
'false enable_caching' => array(
45+
'false enable_caching' => array(
4646
// Custom data.
4747
array(
4848
'enable_caching' => false,
4949
),
5050
// Expected - false is falsy, not processed.
5151
array( 'is_aql' => true ),
5252
),
53-
'zero enable_caching' => array(
53+
'zero enable_caching' => array(
5454
// Custom data.
5555
array(
5656
'enable_caching' => 0,
@@ -83,7 +83,7 @@ public function test_enable_caching_empty_handling( $custom_data, $expected ) {
8383
*/
8484
public function data_enable_caching_enabled() {
8585
return array(
86-
'boolean true' => array(
86+
'boolean true' => array(
8787
// Custom data.
8888
array(
8989
'enable_caching' => true,
@@ -94,7 +94,7 @@ public function data_enable_caching_enabled() {
9494
'enable_caching' => true,
9595
),
9696
),
97-
'integer 1' => array(
97+
'integer 1' => array(
9898
// Custom data.
9999
array(
100100
'enable_caching' => 1,
@@ -105,7 +105,7 @@ public function data_enable_caching_enabled() {
105105
'enable_caching' => 1,
106106
),
107107
),
108-
'string "true"' => array(
108+
'string "true"' => array(
109109
// Custom data.
110110
array(
111111
'enable_caching' => 'true',
@@ -116,7 +116,7 @@ public function data_enable_caching_enabled() {
116116
'enable_caching' => 'true',
117117
),
118118
),
119-
'string "1"' => array(
119+
'string "1"' => array(
120120
// Custom data.
121121
array(
122122
'enable_caching' => '1',

tests/unit/Exclude_Posts_Tests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function test_exclude_posts_returns_empty( $default_data, $custom_data )
6262
*/
6363
public function data_basic_exclude_posts() {
6464
return array(
65-
'exclude two posts' => array(
65+
'exclude two posts' => array(
6666
// Default values.
6767
array(),
6868
// Custom data.

tests/unit/Include_Posts_Tests.php

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Include_Posts_Tests extends TestCase {
2020
*/
2121
public function data_no_posts_included() {
2222
return array(
23-
'no include_posts param' => array(
23+
'no include_posts param' => array(
2424
// Custom data.
2525
array(),
2626
// Expected.
@@ -36,15 +36,15 @@ public function data_no_posts_included() {
3636
'is_aql' => true,
3737
),
3838
),
39-
'null include_posts' => array(
39+
'null include_posts' => array(
4040
// Custom data.
4141
array(
4242
'include_posts' => null,
4343
),
4444
// Expected - null is not an array, returns empty.
4545
array( 'is_aql' => true ),
4646
),
47-
'string include_posts' => array(
47+
'string include_posts' => array(
4848
// Custom data.
4949
array(
5050
'include_posts' => 'not-an-array',
@@ -80,7 +80,7 @@ public function test_include_posts_empty_handling( $custom_data, $expected ) {
8080
*/
8181
public function data_single_post() {
8282
return array(
83-
'single post with id key' => array(
83+
'single post with id key' => array(
8484
// Custom data.
8585
array(
8686
'include_posts' => array(
@@ -148,7 +148,7 @@ public function test_single_post_inclusion( $custom_data, $expected ) {
148148
*/
149149
public function data_multiple_posts() {
150150
return array(
151-
'two posts' => array(
151+
'two posts' => array(
152152
// Custom data.
153153
array(
154154
'include_posts' => array(
@@ -166,11 +166,26 @@ public function data_multiple_posts() {
166166
// Custom data.
167167
array(
168168
'include_posts' => array(
169-
array( 'id' => 100, 'title' => 'Post 1' ),
170-
array( 'id' => 200, 'title' => 'Post 2' ),
171-
array( 'id' => 300, 'title' => 'Post 3' ),
172-
array( 'id' => 400, 'title' => 'Post 4' ),
173-
array( 'id' => 500, 'title' => 'Post 5' ),
169+
array(
170+
'id' => 100,
171+
'title' => 'Post 1',
172+
),
173+
array(
174+
'id' => 200,
175+
'title' => 'Post 2',
176+
),
177+
array(
178+
'id' => 300,
179+
'title' => 'Post 3',
180+
),
181+
array(
182+
'id' => 400,
183+
'title' => 'Post 4',
184+
),
185+
array(
186+
'id' => 500,
187+
'title' => 'Post 5',
188+
),
174189
),
175190
),
176191
// Expected results.
@@ -179,7 +194,7 @@ public function data_multiple_posts() {
179194
'post__in' => array( 100, 200, 300, 400, 500 ),
180195
),
181196
),
182-
'posts with duplicate ids' => array(
197+
'posts with duplicate ids' => array(
183198
// Custom data.
184199
array(
185200
'include_posts' => array(
@@ -233,7 +248,7 @@ public function data_edge_cases() {
233248
'post__in' => array(),
234249
),
235250
),
236-
'mixed posts with and without id' => array(
251+
'mixed posts with and without id' => array(
237252
// Custom data.
238253
array(
239254
'include_posts' => array(
@@ -248,7 +263,7 @@ public function data_edge_cases() {
248263
'post__in' => array( 111, 222 ),
249264
),
250265
),
251-
'post with id value of zero' => array(
266+
'post with id value of zero' => array(
252267
// Custom data.
253268
array(
254269
'include_posts' => array(
@@ -261,7 +276,7 @@ public function data_edge_cases() {
261276
'post__in' => array( 0 ),
262277
),
263278
),
264-
'post with negative id' => array(
279+
'post with negative id' => array(
265280
// Custom data.
266281
array(
267282
'include_posts' => array(
@@ -274,7 +289,7 @@ public function data_edge_cases() {
274289
'post__in' => array( -1 ),
275290
),
276291
),
277-
'post with empty string id' => array(
292+
'post with empty string id' => array(
278293
// Custom data.
279294
array(
280295
'include_posts' => array(
@@ -287,11 +302,11 @@ public function data_edge_cases() {
287302
'post__in' => array( '' ),
288303
),
289304
),
290-
'large number of posts' => array(
305+
'large number of posts' => array(
291306
// Custom data.
292307
array(
293308
'include_posts' => array_map(
294-
function( $i ) {
309+
function ( $i ) {
295310
return array( 'id' => $i );
296311
},
297312
range( 1, 100 )
@@ -326,7 +341,7 @@ public function test_include_posts_edge_cases( $custom_data, $expected ) {
326341
*/
327342
public function test_include_posts_with_other_params() {
328343
$custom_data = array(
329-
'include_posts' => array(
344+
'include_posts' => array(
330345
array( 'id' => 10 ),
331346
array( 'id' => 20 ),
332347
),

tests/unit/Meta_Query_Tests.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Meta_Query_Tests extends TestCase {
2020
*/
2121
public function data_no_meta_query_added() {
2222
return array(
23-
'no meta_query param' => array(
23+
'no meta_query param' => array(
2424
// Default values.
2525
array(),
2626
// Custom data.
@@ -66,7 +66,7 @@ public function test_meta_query_empty_handling( $default_data, $custom_data, $ex
6666
*/
6767
public function data_single_meta_query() {
6868
return array(
69-
'single query with all fields' => array(
69+
'single query with all fields' => array(
7070
// Custom data.
7171
array(
7272
'meta_query' => array(
@@ -93,7 +93,7 @@ public function data_single_meta_query() {
9393
),
9494
),
9595
),
96-
'single query without compare and type' => array(
96+
'single query without compare and type' => array(
9797
// Custom data.
9898
array(
9999
'meta_query' => array(
@@ -164,7 +164,7 @@ public function test_single_meta_query( $custom_data, $expected_results ) {
164164
*/
165165
public function data_multiple_meta_queries() {
166166
return array(
167-
'two queries with AND relation' => array(
167+
'two queries with AND relation' => array(
168168
// Custom data.
169169
array(
170170
'meta_query' => array(
@@ -205,7 +205,7 @@ public function data_multiple_meta_queries() {
205205
),
206206
),
207207
),
208-
'two queries with OR relation' => array(
208+
'two queries with OR relation' => array(
209209
// Custom data.
210210
array(
211211
'meta_query' => array(
@@ -328,7 +328,7 @@ public function data_edge_cases() {
328328
'meta_query' => array(),
329329
),
330330
),
331-
'relation without queries' => array(
331+
'relation without queries' => array(
332332
// Custom data.
333333
array(
334334
'meta_query' => array(
@@ -343,7 +343,7 @@ public function data_edge_cases() {
343343
),
344344
),
345345
),
346-
'numeric meta values' => array(
346+
'numeric meta values' => array(
347347
// Custom data.
348348
array(
349349
'meta_query' => array(
@@ -370,7 +370,7 @@ public function data_edge_cases() {
370370
),
371371
),
372372
),
373-
'LIKE comparison' => array(
373+
'LIKE comparison' => array(
374374
// Custom data.
375375
array(
376376
'meta_query' => array(

0 commit comments

Comments
 (0)