Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** @test * */
- public function index_should_filter_and_sort_records()
- {
- $posta = factory(\App\Poste::class)->create();
- $mock = Mockery::mock(\App\Poste::class);
- $mock->shouldReceive('where')->with('name',\Mockery::any(),"%$posta->name%")
- ->once()
- ->andReturn($mock);
- $mock->shouldReceive('where')->with('number',\Mockery::any(),$posta->number)
- ->once()
- ->andReturn($mock);
- $mock->shouldReceive('doOrderBy')->with('name:desc')
- ->once()
- ->andReturn($mock);
- $mock->shouldReceive('paginate')
- ->once()
- ->andReturn($mock);
- $this->app->instance(\App\Poste::class, $mock);
- $this->json('GET', '/api/poste', $data = ["name" => $posta->name ,"number" => $posta->number,"sort" =>"name:desc"]);
- }
Add Comment
Please, Sign In to add comment