@@ -17,11 +17,11 @@ public function shouldGetAllUsers()
1717 $ api = $ this ->getApiMock ();
1818 $ api ->expects ($ this ->once ())
1919 ->method ('get ' )
20- ->with ('users ' , array (' active ' => null , ' page ' => 1 , ' per_page ' => 10 ))
20+ ->with ('users ' , array ())
2121 ->will ($ this ->returnValue ($ expectedArray ))
2222 ;
2323
24- $ this ->assertEquals ($ expectedArray , $ api ->all (null , 1 , 10 ));
24+ $ this ->assertEquals ($ expectedArray , $ api ->all ());
2525 }
2626
2727 /**
@@ -37,88 +37,11 @@ public function shouldGetActiveUsers()
3737 $ api = $ this ->getApiMock ();
3838 $ api ->expects ($ this ->once ())
3939 ->method ('get ' )
40- ->with ('users ' , array ('active ' => true , 'page ' => 1 , 'per_page ' => AbstractApi::PER_PAGE ))
41- ->will ($ this ->returnValue ($ expectedArray ))
42- ;
43-
44- $ this ->assertEquals ($ expectedArray , $ api ->all (true ));
45- }
46-
47- /**
48- * @test
49- */
50- public function shouldNotNeedPaginationWhenGettingUsers ()
51- {
52- $ expectedArray = array (
53- array ('id ' => 1 , 'name ' => 'Matt ' ),
54- array ('id ' => 2 , 'name ' => 'John ' ),
55- );
56-
57- $ api = $ this ->getApiMock ();
58- $ api ->expects ($ this ->once ())
59- ->method ('get ' )
60- ->with ('users ' , array ('active ' => null , 'page ' => 1 , 'per_page ' => AbstractApi::PER_PAGE ))
61- ->will ($ this ->returnValue ($ expectedArray ))
62- ;
63-
64- $ this ->assertEquals ($ expectedArray , $ api ->all ());
65- }
66-
67- /**
68- * @test
69- */
70- public function shouldSearchUsers ()
71- {
72- $ expectedArray = array (
73- array ('id ' => 1 , 'name ' => 'Matt ' )
74- );
75-
76- $ api = $ this ->getApiMock ();
77- $ api ->expects ($ this ->once ())
78- ->method ('get ' )
79- ->with ('users ' , array ('search ' => 'ma ' , 'active ' => null , 'page ' => 1 , 'per_page ' => AbstractApi::PER_PAGE ))
80- ->will ($ this ->returnValue ($ expectedArray ))
81- ;
82-
83- $ this ->assertEquals ($ expectedArray , $ api ->search ('ma ' ));
84- }
85-
86- /**
87- * @test
88- */
89- public function shouldSearchActiveUsers ()
90- {
91- $ expectedArray = array (
92- array ('id ' => 1 , 'name ' => 'Matt ' )
93- );
94-
95- $ api = $ this ->getApiMock ();
96- $ api ->expects ($ this ->once ())
97- ->method ('get ' )
98- ->with ('users ' , array ('search ' => 'ma ' , 'active ' => true , 'page ' => 1 , 'per_page ' => AbstractApi::PER_PAGE ))
99- ->will ($ this ->returnValue ($ expectedArray ))
100- ;
101-
102- $ this ->assertEquals ($ expectedArray , $ api ->search ('ma ' , true ));
103- }
104-
105- /**
106- * @test
107- */
108- public function shouldSearchActiveUsersWithPagination ()
109- {
110- $ expectedArray = array (
111- array ('id ' => 1 , 'name ' => 'Matt ' )
112- );
113-
114- $ api = $ this ->getApiMock ();
115- $ api ->expects ($ this ->once ())
116- ->method ('get ' )
117- ->with ('users ' , array ('search ' => 'ma ' , 'active ' => true , 'page ' => 2 , 'per_page ' => 5 ))
40+ ->with ('users ' , array ('active ' => true ))
11841 ->will ($ this ->returnValue ($ expectedArray ))
11942 ;
12043
121- $ this ->assertEquals ($ expectedArray , $ api ->search ( ' ma ' , true , 2 , 5 ));
44+ $ this ->assertEquals ($ expectedArray , $ api ->all ([ ' active ' => true ] ));
12245 }
12346
12447 /**
0 commit comments