diff --git a/tests/Feature/Admin/AdminSettingsTest.php b/tests/Feature/Admin/AdminSettingsTest.php index 7880a184..274de0aa 100644 --- a/tests/Feature/Admin/AdminSettingsTest.php +++ b/tests/Feature/Admin/AdminSettingsTest.php @@ -10,18 +10,14 @@ use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory; use function Pest\Laravel\getJson; use function Pest\Laravel\postJson; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); - $user = User::find(1); - $this->withHeaders([ - 'company' => $user->companies()->first()->id, - ]); - Sanctum::actingAs( - $user, - ['*'] - ); + $user = User::query()->find(1); + $companyId = $user->companies()->first()->getKey(); + $this->withHeaders(['company' => $companyId]); + Sanctum::actingAs($user, ['*']); }); test('company settings config uses canonical v2 links', function () { diff --git a/tests/Feature/Admin/CreditNoteSchemaTest.php b/tests/Feature/Admin/CreditNoteSchemaTest.php index 2157db3b..52a1725b 100644 --- a/tests/Feature/Admin/CreditNoteSchemaTest.php +++ b/tests/Feature/Admin/CreditNoteSchemaTest.php @@ -8,9 +8,9 @@ use App\Domains\Taxation\Models\Tax; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Schema; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); }); /** diff --git a/tests/Feature/Admin/CreditNoteTest.php b/tests/Feature/Admin/CreditNoteTest.php index 9d779c70..f75a89cf 100644 --- a/tests/Feature/Admin/CreditNoteTest.php +++ b/tests/Feature/Admin/CreditNoteTest.php @@ -22,14 +22,13 @@ use function Pest\Laravel\getJson; use function Pest\Laravel\postJson; use function Pest\Laravel\putJson; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); - $user = User::find(1); - $this->withHeaders([ - 'company' => $user->companies()->first()->id, - ]); + $user = User::query()->find(1); + $companyId = $user->companies()->first()->getKey(); + $this->withHeaders(['company' => $companyId]); Sanctum::actingAs($user, ['*']); }); diff --git a/tests/Feature/Company/CompanyMailConfigurationControllerTest.php b/tests/Feature/Company/CompanyMailConfigurationControllerTest.php index 4ad702c0..3bd12677 100644 --- a/tests/Feature/Company/CompanyMailConfigurationControllerTest.php +++ b/tests/Feature/Company/CompanyMailConfigurationControllerTest.php @@ -10,11 +10,11 @@ use Laravel\Sanctum\Sanctum; use function Pest\Laravel\getJson; use function Pest\Laravel\postJson; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); - $user = User::find(1); + $user = User::query()->find(1); $this->companyId = $user->companies()->first()->id; $this->withHeaders([ diff --git a/tests/Feature/Customer/AuthTest.php b/tests/Feature/Customer/AuthTest.php index 31b41dfa..ff1eb485 100644 --- a/tests/Feature/Customer/AuthTest.php +++ b/tests/Feature/Customer/AuthTest.php @@ -5,9 +5,9 @@ use Illuminate\Support\Facades\Artisan; use function Pest\Laravel\postJson; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); }); test('customer portal guest entrypoints return the spa shell', function () { diff --git a/tests/Feature/CustomerStatementTest.php b/tests/Feature/CustomerStatementTest.php index ad693782..d6d23222 100644 --- a/tests/Feature/CustomerStatementTest.php +++ b/tests/Feature/CustomerStatementTest.php @@ -18,9 +18,9 @@ use function Pest\Laravel\get; use function Pest\Laravel\getJson; use function Pest\Laravel\postJson; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); $this->user = User::findOrFail(1); $this->company = $this->user->companies()->firstOrFail(); diff --git a/tests/Feature/Marketplace/MarketplacePairingTest.php b/tests/Feature/Marketplace/MarketplacePairingTest.php index 75ed68c8..f03a6c7e 100644 --- a/tests/Feature/Marketplace/MarketplacePairingTest.php +++ b/tests/Feature/Marketplace/MarketplacePairingTest.php @@ -10,9 +10,9 @@ use Laravel\Sanctum\Sanctum; use function Pest\Laravel\deleteJson; use function Pest\Laravel\postJson; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); Sanctum::actingAs(User::findOrFail(1), ['*']); config()->set('invoiceshelf.base_url', 'https://marketplace.test'); }); diff --git a/tests/Feature/PaymentAllocationTest.php b/tests/Feature/PaymentAllocationTest.php index ca046b0a..77ae4c8b 100644 --- a/tests/Feature/PaymentAllocationTest.php +++ b/tests/Feature/PaymentAllocationTest.php @@ -16,9 +16,9 @@ use Illuminate\Validation\ValidationException; use Laravel\Sanctum\Sanctum; use Silber\Bouncer\BouncerFacade; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); }); function allocatableInvoice(int $amount = 10000): Invoice @@ -42,9 +42,7 @@ function allocatableInvoice(int $amount = 10000): Invoice function allocationPayment(Invoice $invoice, int $amount): Payment { return Payment::factory()->create([ - 'company_id' => $invoice->company_id, - 'customer_id' => $invoice->customer_id, - 'currency_id' => $invoice->currency_id, + ...$invoice->only(['company_id', 'customer_id', 'currency_id']), 'amount' => $amount, 'base_amount' => $amount, 'exchange_rate' => 1, @@ -132,15 +130,11 @@ test('allocations reject mismatched currencies, customers, drafts, and credit no 'currency_id' => $otherCurrency->id, ]), allocatableInvoice(100)->forceFill([ - 'company_id' => $invoice->company_id, - 'customer_id' => $invoice->customer_id, - 'currency_id' => $invoice->currency_id, + ...$invoice->only(['company_id', 'customer_id', 'currency_id']), 'status' => Invoice::STATUS_DRAFT, ]), allocatableInvoice(100)->forceFill([ - 'company_id' => $invoice->company_id, - 'customer_id' => $invoice->customer_id, - 'currency_id' => $invoice->currency_id, + ...$invoice->only(['company_id', 'customer_id', 'currency_id']), 'type' => Invoice::TYPE_CREDIT_NOTE, ]), ])->each->save(); diff --git a/tests/Feature/Pdf/TaxSummaryReportTest.php b/tests/Feature/Pdf/TaxSummaryReportTest.php index 1e79ef17..e8f491a3 100644 --- a/tests/Feature/Pdf/TaxSummaryReportTest.php +++ b/tests/Feature/Pdf/TaxSummaryReportTest.php @@ -13,9 +13,9 @@ use Laravel\Sanctum\Sanctum; use function Pest\Laravel\get; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); $user = User::findOrFail(1); $this->company = $user->companies()->firstOrFail(); diff --git a/tests/Feature/RealisticDemoSeederTest.php b/tests/Feature/RealisticDemoSeederTest.php index 108bc20b..389879b2 100644 --- a/tests/Feature/RealisticDemoSeederTest.php +++ b/tests/Feature/RealisticDemoSeederTest.php @@ -10,9 +10,9 @@ use Carbon\Carbon; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Queue; -beforeEach(function () { - Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); - Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); +beforeEach(function (): void { + Artisan::call('db:seed', ['--force' => true, '--class' => 'DatabaseSeeder']); + Artisan::call('db:seed', ['--force' => true, '--class' => 'DemoSeeder']); Queue::fake(); });