I have a test that I am trying to run on a scoped DB query that returns only results from the currently logged in user's team. I am having issues with the test failing because Auth::user() doesn't seem to work when testing with actingAs. Here is my test:
/** @test */
function a_team_has_ten_tickets()
{
$this->assertCount(10, $this->team_testing->tickets);
}
And the scoped query is:
public function apply(Builder $builder, Model $model)
{
return $builder->where('team_id', Auth::user()->current_team_id);
}
Any ideas why this is not working, or how to make this work?
Original question here: http://ift.tt/1Nt1rD0
Aucun commentaire:
Enregistrer un commentaire