adrema/tests/Feature/Payment/MemberPaymentsBlockTest.php

40 lines
944 B
PHP
Raw Normal View History

2022-11-17 02:15:29 +01:00
<?php
namespace Tests\Feature\Payment;
use App\Member\Member;
use App\Payment\MemberPaymentBlock;
use App\Payment\Payment;
use Illuminate\Foundation\Testing\DatabaseTransactions;
2022-12-13 23:11:32 +01:00
use Tests\RequestFactories\Child;
2022-11-17 02:15:29 +01:00
use Tests\TestCase;
2022-11-17 02:23:46 +01:00
class MemberPaymentsBlockTest extends TestCase
2022-11-17 02:15:29 +01:00
{
use DatabaseTransactions;
public function testItHasData(): void
{
$this->login()->loginNami();
Member::factory()
->defaults()
2022-12-13 23:11:32 +01:00
->has(Payment::factory()->notPaid()->subscription('example', [
new Child('gg', 3400),
new Child('gg', 100),
]))
2022-11-17 02:15:29 +01:00
->create();
Member::factory()
->defaults()
->create();
2022-11-17 02:23:46 +01:00
$data = app(MemberPaymentBlock::class)->render()['data'];
2022-11-17 02:15:29 +01:00
$this->assertEquals([
2022-12-13 23:11:32 +01:00
'amount' => '35,00 €',
2022-11-17 02:15:29 +01:00
'members' => 1,
'total_members' => 2,
], $data);
}
}