adrema/tests/Feature/Invoice/MemberPaymentBlockTest.php

37 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature\Invoice;
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;
use Livewire\Livewire;
use Modules\Invoice\MemberPaymentBlock as InvoiceMemberPaymentBlock;
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();
Livewire::test(InvoiceMemberPaymentBlock::class)
->assertSee('1 / 2')
->assertSee('51,00 €');
}
}