From ca4cbb918ba32c843fc4303e254d3df7fbffa6e2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 21 Jul 2021 09:13:04 +1000 Subject: [PATCH] Minor fixes for tests --- tests/Feature/ClientPortal/CreditsTest.php | 11 ++++++++++- tests/Feature/ClientPortal/InvoicesTest.php | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/Feature/ClientPortal/CreditsTest.php b/tests/Feature/ClientPortal/CreditsTest.php index dc61ad687b..6b20980a45 100644 --- a/tests/Feature/ClientPortal/CreditsTest.php +++ b/tests/Feature/ClientPortal/CreditsTest.php @@ -12,6 +12,8 @@ namespace Tests\Feature\ClientPortal; +use App\DataMapper\ClientSettings; +use App\DataMapper\CompanySettings; use App\Http\Livewire\CreditsTable; use App\Models\Account; use App\Models\Client; @@ -19,6 +21,7 @@ use App\Models\ClientContact; use App\Models\Company; use App\Models\Credit; use App\Models\User; +use App\Utils\Traits\AppSetup; use Faker\Factory; use Illuminate\Foundation\Testing\DatabaseTransactions; use Livewire\Livewire; @@ -28,12 +31,14 @@ use function now; class CreditsTest extends TestCase { use DatabaseTransactions; - + use AppSetup; + public function setUp(): void { parent::setUp(); $this->faker = Factory::create(); + $this->buildCache(true); } public function testShowingOnlyCreditsWithDueDateLessOrEqualToNow() @@ -45,8 +50,12 @@ class CreditsTest extends TestCase ); $company = Company::factory()->create(['account_id' => $account->id]); + $company->settings = CompanySettings::defaults(); + $company->save(); $client = Client::factory()->create(['company_id' => $company->id, 'user_id' => $user->id]); + $client->settings = ClientSettings::defaults(); + $client->save(); ClientContact::factory()->count(2)->create([ 'user_id' => $user->id, diff --git a/tests/Feature/ClientPortal/InvoicesTest.php b/tests/Feature/ClientPortal/InvoicesTest.php index 2ec29de8ca..49ca142382 100644 --- a/tests/Feature/ClientPortal/InvoicesTest.php +++ b/tests/Feature/ClientPortal/InvoicesTest.php @@ -20,6 +20,7 @@ use App\Models\ClientContact; use App\Models\Company; use App\Models\Invoice; use App\Models\User; +use App\Utils\Traits\AppSetup; use Faker\Factory; use Illuminate\Foundation\Testing\DatabaseTransactions; use Livewire\Livewire; @@ -28,12 +29,15 @@ use Tests\TestCase; class InvoicesTest extends TestCase { use DatabaseTransactions; - + use AppSetup; + public function setUp(): void { parent::setUp(); $this->faker = Factory::create(); + $this->buildCache(true); + } public function testInvoiceTableFilters()