From 19a991e4c3ed8996bfe7777f2d8deb46acd3c841 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 17 Jul 2024 09:49:28 +1000 Subject: [PATCH] Fixes for seeder --- ...6_231556_2024_07_17_add_dubai_timezone.php | 2 +- .../Feature/Account/AccountEmailQuotaTest.php | 24 +++++++++++++++---- tests/Feature/Export/ArDetailReportTest.php | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/database/migrations/2024_07_16_231556_2024_07_17_add_dubai_timezone.php b/database/migrations/2024_07_16_231556_2024_07_17_add_dubai_timezone.php index 6ee5ff904ed0..8b2740484f54 100644 --- a/database/migrations/2024_07_16_231556_2024_07_17_add_dubai_timezone.php +++ b/database/migrations/2024_07_16_231556_2024_07_17_add_dubai_timezone.php @@ -14,7 +14,7 @@ return new class extends Migration { $t = \App\Models\Timezone::find(115); - if(!$t){ + if(!$t && \App\Models\Timezone::count() > 1){ $t = new Timezone(); $t->id = 115; diff --git a/tests/Feature/Account/AccountEmailQuotaTest.php b/tests/Feature/Account/AccountEmailQuotaTest.php index ba44053e19df..3d0c0cfc3968 100644 --- a/tests/Feature/Account/AccountEmailQuotaTest.php +++ b/tests/Feature/Account/AccountEmailQuotaTest.php @@ -12,13 +12,15 @@ namespace Tests\Feature\Account; -use App\DataMapper\ClientRegistrationFields; -use App\DataMapper\CompanySettings; +use Tests\TestCase; +use App\Models\User; +use App\Utils\Ninja; use App\Models\Account; use App\Models\Company; -use App\Utils\Ninja; +use App\DataMapper\CompanySettings; +use App\Factory\CompanyUserFactory; use Illuminate\Support\Facades\Cache; -use Tests\TestCase; +use App\DataMapper\ClientRegistrationFields; class AccountEmailQuotaTest extends TestCase { @@ -50,6 +52,20 @@ class AccountEmailQuotaTest extends TestCase 'account_id' => $account->id, ]); + $hash = \Illuminate\Support\Str::random(32); + + $user = User::factory()->create([ + 'account_id' => $account->id, + 'confirmation_code' => $hash, + 'email' => "{$hash}@example.com", + ]); + + $cu = CompanyUserFactory::create($user->id, $company->id, $account->id); + $cu->is_owner = true; + $cu->is_admin = true; + $cu->is_locked = false; + $cu->save(); + $company->client_registration_fields = ClientRegistrationFields::generate(); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Export/ArDetailReportTest.php b/tests/Feature/Export/ArDetailReportTest.php index 75d6591ed562..eadc71efd349 100644 --- a/tests/Feature/Export/ArDetailReportTest.php +++ b/tests/Feature/Export/ArDetailReportTest.php @@ -95,7 +95,7 @@ class ArDetailReportTest extends TestCase $settings->client_online_payment_notification = false; $settings->client_manual_payment_notification = false; $settings->currency_id = '1'; - + $this->company = Company::factory()->create([ 'account_id' => $this->account->id, 'settings' => $settings,