Update for tests

This commit is contained in:
Benjamin Beganović 2021-07-02 01:37:44 +02:00
parent d0e59e1d27
commit 9ea59e2c7a

View File

@ -45,13 +45,13 @@ class CreditsTest extends TestCase
public function testShowingOnlyQuotesWithDueDateLessOrEqualToNow() public function testShowingOnlyQuotesWithDueDateLessOrEqualToNow()
{ {
// Create two credits, one with due_date in future, one with now, one with less than now.
Credit::factory()->create([ Credit::factory()->create([
'user_id' => $this->user->id, 'user_id' => $this->user->id,
'company_id' => $this->company->id, 'company_id' => $this->company->id,
'client_id' => $this->client->id, 'client_id' => $this->client->id,
'number' => 'testing-number-01', 'number' => 'testing-number-01',
'due_date' => now()->subDays(5), 'due_date' => now()->subDays(5),
'status_id' => Credit::STATUS_SENT,
]); ]);
Credit::factory()->create([ Credit::factory()->create([
@ -60,6 +60,7 @@ class CreditsTest extends TestCase
'client_id' => $this->client->id, 'client_id' => $this->client->id,
'number' => 'testing-number-02', 'number' => 'testing-number-02',
'due_date' => now(), 'due_date' => now(),
'status_id' => Credit::STATUS_SENT,
]); ]);
Credit::factory()->create([ Credit::factory()->create([
@ -68,15 +69,12 @@ class CreditsTest extends TestCase
'client_id' => $this->client->id, 'client_id' => $this->client->id,
'number' => 'testing-number-03', 'number' => 'testing-number-03',
'due_date' => now()->addDays(5), 'due_date' => now()->addDays(5),
'status_id' => Credit::STATUS_SENT,
]); ]);
$this->actingAs($this->client); $this->actingAs($this->client->contacts->first(), 'contact');
// Argument 1 passed to Illuminate\Foundation\Testing\TestCase::actingAs() must implement interface Livewire::test(CreditsTable::class, ['company' => $this->company])
// Illuminate\Contracts\Auth\Authenticatable, instance of App\Models\Client given,
// called in /var/www/html/tests/ClientPortal/CreditsTest.php on line 65
Livewire::test(CreditsTable::class)
->assertSee('testing-number-01') ->assertSee('testing-number-01')
->assertSee('testing-number-02') ->assertSee('testing-number-02')
->assertDontSee('testing-number-03'); ->assertDontSee('testing-number-03');