adrema/tests/Feature/Invoice/MemberPaymentBlockTest.php

37 lines
1.3 KiB
PHP
Raw Normal View History

2023-12-17 01:49:12 +01:00
<?php
namespace Tests\Feature\Invoice;
2023-12-17 01:49:12 +01:00
use App\Invoice\Enums\InvoiceStatus;
use App\Invoice\MemberPaymentBlock;
use App\Invoice\Models\Invoice;
use App\Invoice\Models\InvoicePosition;
use App\Member\Member;
use Illuminate\Foundation\Testing\DatabaseTransactions;
2024-10-13 21:00:47 +02:00
use Livewire\Livewire;
use Modules\Invoice\MemberPaymentBlock as InvoiceMemberPaymentBlock;
2023-12-17 01:49:12 +01:00
use Tests\TestCase;
class MemberPaymentBlockTest extends TestCase
{
use DatabaseTransactions;
public function testItHasData(): void
{
$this->login()->loginNami();
$member = Member::factory()->defaults()->create();
Member::factory()->defaults()->create();
Invoice::factory()
->has(InvoicePosition::factory()->price(3500)->for($member), 'positions')
->has(InvoicePosition::factory()->price(1000)->for($member), 'positions')
->status(InvoiceStatus::SENT)->create();
Invoice::factory()->has(InvoicePosition::factory()->price(600)->for($member), 'positions')->status(InvoiceStatus::NEW)->create();
Invoice::factory()->has(InvoicePosition::factory()->price(1000)->for($member), 'positions')->status(InvoiceStatus::PAID)->create();
2024-10-13 21:00:47 +02:00
Livewire::test(InvoiceMemberPaymentBlock::class)
->assertSee('1 / 2')
->assertSee('51,00 €');
2023-12-17 01:49:12 +01:00
}
}