@@ -44,6 +44,46 @@ public function shouldNotNeedPaginationWhenGettingGroups()
44
44
$ this ->assertEquals ($ expectedArray , $ api ->all ());
45
45
}
46
46
47
+ /**
48
+ * @test
49
+ */
50
+ public function shouldSearchGroups ()
51
+ {
52
+ $ expectedArray = array (
53
+ array ('id ' => 1 , 'name ' => 'A group ' ),
54
+ array ('id ' => 2 , 'name ' => 'Another group ' ),
55
+ );
56
+
57
+ $ api = $ this ->getApiMock ();
58
+ $ api ->expects ($ this ->once ())
59
+ ->method ('get ' )
60
+ ->with ('groups?search=group ' , array ('page ' => 1 , 'per_page ' => AbstractApi::PER_PAGE ))
61
+ ->will ($ this ->returnValue ($ expectedArray ))
62
+ ;
63
+
64
+ $ this ->assertEquals ($ expectedArray , $ api ->search ('group ' ));
65
+ }
66
+
67
+ /**
68
+ * @test
69
+ */
70
+ public function shouldSearchGroupsWithPagination ()
71
+ {
72
+ $ expectedArray = array (
73
+ array ('id ' => 1 , 'name ' => 'A group ' ),
74
+ array ('id ' => 2 , 'name ' => 'Another group ' ),
75
+ );
76
+
77
+ $ api = $ this ->getApiMock ();
78
+ $ api ->expects ($ this ->once ())
79
+ ->method ('get ' )
80
+ ->with ('groups?search=group ' , array ('page ' => 2 , 'per_page ' => 5 ))
81
+ ->will ($ this ->returnValue ($ expectedArray ))
82
+ ;
83
+
84
+ $ this ->assertEquals ($ expectedArray , $ api ->search ('group ' , 2 , 5 ));
85
+ }
86
+
47
87
/**
48
88
* @test
49
89
*/
0 commit comments