Skip to content

Commit

Permalink
Added phpunit test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
emgk committed Jun 14, 2018
1 parent 0514679 commit 6c5d015
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions WordPress/Tests/VIP/SuppressFiltersUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,22 @@ get_children( $args4 ); // Bad.
get_posts( array( 'post_type' => 'post', 'suppress_filters'=> true ) ); // Bad.
wp_get_recent_posts( array( 'post_type' => 'post', 'suppress_filters'=> true ) ); // Bad.
get_children( array( 'post_type' => 'post', 'suppress_filters'=> true ) ); // Bad.

$post_args = array();
$post_args['suppress_filters'] = true;

get_posts( $post_args ); // Bad.
wp_get_recent_posts( $post_args ); // Bad.
get_children( $post_args ); // Bad.

function test_suppress_filter() {
$args = array( 'post_type' => 'post', 'suppress_filters' => true );
get_posts( $args ); // Bad
wp_get_recent_posts( $args ); // Bad
get_children( $args ); // Bad

$args_ok = array( 'post_type' => 'post', 'suppress_filters' => false );
get_posts( $args_ok ); // Ok
wp_get_recent_posts( $args_ok ); // Ok
get_children( $args_ok ); // Ok
}
9 changes: 9 additions & 0 deletions WordPress/Tests/VIP/SuppressFiltersUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ public function getWarningList() {
28 => 1,
29 => 1,
30 => 1,
35 => 1,
36 => 1,
37 => 1,
41 => 1,
42 => 1,
43 => 1,
46 => 1,
47 => 1,
48 => 1
);

}
Expand Down

0 comments on commit 6c5d015

Please sign in to comment.