@@ -74,10 +74,9 @@ public function users()
7474 public function test_search_query_works ()
7575 {
7676 $ users =
$ this ->
mockUsers (
10 , [
'[email protected] ' ]);
77- $ request = Mockery::mock (RestifyRequest::class);
7877 $ model =
$ users->
where (
'email ' ,
'[email protected] ' )->
first ();
//find manually the model 7978 $ repository = Restify::repositoryForModel (get_class ($ model ));
80- $ expected = $ repository ::resolveWith ($ model )->toArray (request ( ));
79+ $ expected = $ repository ::resolveWith ($ model )->toArray (resolve (RestifyRequest::class ));
8180 unset($ expected ['relationships ' ]);
8281
8382 $ r = $ this ->withExceptionHandling ()
@@ -171,6 +170,10 @@ public function test_that_match_param_works()
171170 ->andReturnFalse ();
172171 $ request ->shouldReceive ('get ' )
173172 ->andReturnFalse ();
173+ $ request ->shouldReceive ('isDetailRequest ' )
174+ ->andReturnFalse ();
175+ $ request ->shouldReceive ('isIndexRequest ' )
176+ ->andReturnTrue ();
174177
175178 $ model =
$ users->
where (
'email ' ,
'[email protected] ' )->
first ();
176179 $ repository = Restify::repositoryForModel (get_class ($ model ));
@@ -210,6 +213,10 @@ public function test_that_with_param_works()
210213 ->andReturnTrue ();
211214 $ request ->shouldReceive ('get ' )
212215 ->andReturn ('posts ' );
216+ $ request ->shouldReceive ('isDetailRequest ' )
217+ ->andReturnFalse ();
218+ $ request ->shouldReceive ('isIndexRequest ' )
219+ ->andReturnTrue ();
213220
214221 $ r = $ this ->withExceptionHandling ()
215222 ->getJson ('/restify-api/users?with=posts ' )
0 commit comments