12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
51
tests/Feature/Billing/BillingModelsTest.php
Normal file
51
tests/Feature/Billing/BillingModelsTest.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\PaymentOption;
|
||||
use App\Models\UserPaymentOption;
|
||||
use Database\Seeders\PaymentOptionSeeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\TestCase;
|
||||
|
||||
test('payment option seeder creates multilingual options', function () {
|
||||
/** @var TestCase $this */
|
||||
$this->seed(PaymentOptionSeeder::class);
|
||||
|
||||
$monthly = PaymentOption::query()
|
||||
->where('article_number', 'PR-MONTHLY-001')
|
||||
->firstOrFail();
|
||||
|
||||
expect($monthly->translations()->count())->toBe(2);
|
||||
});
|
||||
|
||||
test('user payment option supports company pivot and payments relation', function () {
|
||||
/** @var TestCase $this */
|
||||
$userPaymentOption = UserPaymentOption::factory()->create();
|
||||
$company = Company::query()->create([
|
||||
'name' => 'Test Company '.Str::random(6),
|
||||
'slug' => 'test-company-'.Str::lower(Str::random(8)),
|
||||
]);
|
||||
|
||||
$userPaymentOption->companies()->attach($company->id, ['is_active' => true]);
|
||||
$payment = $userPaymentOption->payments()->create([
|
||||
'amount_cents' => 9900,
|
||||
'currency' => 'EUR',
|
||||
'status' => 'succeeded',
|
||||
'stripe_charge_id' => 'ch_test_123456',
|
||||
]);
|
||||
|
||||
$this->assertModelExists($payment);
|
||||
expect($userPaymentOption->companies()->whereKey($company->id)->exists())->toBeTrue();
|
||||
expect($userPaymentOption->payments()->count())->toBe(1);
|
||||
});
|
||||
|
||||
test('invoice factory creates valid relation graph', function () {
|
||||
/** @var TestCase $this */
|
||||
$invoice = Invoice::factory()->create();
|
||||
|
||||
$this->assertModelExists($invoice);
|
||||
expect($invoice->user)->not->toBeNull();
|
||||
expect($invoice->invoiceBillingAddress)->not->toBeNull();
|
||||
expect($invoice->userPayment)->not->toBeNull();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue