faker = Factory::create(); Model::reguard(); $this->makeTestData(); } public function testShowingOnlyQuotesWithDueDateLessOrEqualToNow() { Credit::factory()->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id, 'number' => 'testing-number-01', 'due_date' => now()->subDays(5), 'status_id' => Credit::STATUS_SENT, ]); Credit::factory()->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id, 'number' => 'testing-number-02', 'due_date' => now(), 'status_id' => Credit::STATUS_SENT, ]); Credit::factory()->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id, 'number' => 'testing-number-03', 'due_date' => now()->addDays(5), 'status_id' => Credit::STATUS_SENT, ]); $this->actingAs($this->client->contacts->first(), 'contact'); Livewire::test(CreditsTable::class, ['company' => $this->company]) ->assertSee('testing-number-01') ->assertSee('testing-number-02') ->assertDontSee('testing-number-03'); } }