Guest User

Untitled

a guest
Feb 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. /** @test * */
  2. public function index_should_filter_and_sort_records()
  3. {
  4. $posta = factory(\App\Poste::class)->create();
  5. $mock = Mockery::mock(\App\Poste::class);
  6.  
  7. $mock->shouldReceive('where')->with('name',\Mockery::any(),"%$posta->name%")
  8. ->once()
  9. ->andReturn($mock);
  10. $mock->shouldReceive('where')->with('number',\Mockery::any(),$posta->number)
  11. ->once()
  12. ->andReturn($mock);
  13. $mock->shouldReceive('doOrderBy')->with('name:desc')
  14. ->once()
  15. ->andReturn($mock);
  16. $mock->shouldReceive('paginate')
  17. ->once()
  18. ->andReturn($mock);
  19.  
  20. $this->app->instance(\App\Poste::class, $mock);
  21.  
  22.  
  23. $this->json('GET', '/api/poste', $data = ["name" => $posta->name ,"number" => $posta->number,"sort" =>"name:desc"]);
  24.  
  25.  
  26.  
  27.  
  28. }
Add Comment
Please, Sign In to add comment