@@ -30,19 +30,29 @@ function testRetrievePostsCheckTitle() {
3030 }
3131
3232 function testSearchPosts () {
33+ $ pid = $ this ->buildStream ();
3334 $ bagel_post = $ this ->factory ->post ->create (array ('post_title ' => 'Bagels ' ));
3435 $ croissant_post = $ this ->factory ->post ->create (array ('post_title ' => 'Croissants ' ));
3536 $ pastries_post = $ this ->factory ->post ->create (array ('post_title ' => 'Croissants and Bagels ' ));
36- $ output = StreamManagerAjaxHelper::search_posts ('bagel ' );
37+ $ output = StreamManagerAjaxHelper::search_posts ('bagel ' , $ pid );
3738 $ this ->assertEquals (2 , count ($ output ));
3839 $ this ->assertEquals ('1 min ' , $ output [0 ]['human_date ' ]);
3940 }
4041
42+ function testSearchPostsAppliesFilter () {
43+ $ pid = $ this ->buildStream ('Test Stream ' , array ('post_type ' => 'pastry ' ));
44+ $ this ->factory ->post ->create (array ('post_title ' => 'bagel1 ' ));
45+ $ this ->factory ->post ->create (array ('post_title ' => 'bagel2 ' ));
46+ $ this ->factory ->post ->create (array ('post_title ' => 'bagel3 ' , 'post_type ' => 'pastry ' ));
47+ $ output = StreamManagerAjaxHelper::search_posts ('bagel ' , $ pid );
48+ $ this ->assertEquals (1 , count ($ output ));
49+ }
50+
4151 function testSearchPostsNoMatches () {
52+ $ pid = $ this ->buildStream ();
4253 $ bagel_post = $ this ->factory ->post ->create (array ('post_title ' => 'Bagels ' ));
43- $ output = StreamManagerAjaxHelper::search_posts ('muffin ' );
54+ $ output = StreamManagerAjaxHelper::search_posts ('muffin ' , $ pid );
4455 $ this ->assertEquals (0 , count ($ output ));
4556 }
4657
47-
4858 }
0 commit comments