adrema/tests/Feature/Member/ShowTest.php

42 lines
1.4 KiB
PHP
Raw Normal View History

2022-11-18 15:55:44 +01:00
<?php
namespace Tests\Feature\Member;
use App\Member\Member;
use App\Member\Membership;
2022-11-18 22:34:50 +01:00
use App\Payment\Payment;
2022-11-18 15:55:44 +01:00
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
class ShowTest extends TestCase
{
use DatabaseTransactions;
public function testItShowsSingleMember(): void
{
$this->withoutExceptionHandling()->login()->loginNami();
$member = Member::factory()
->has(Membership::factory()->in('€ LeiterIn', 5, 'Jungpfadfinder', 88)->state(['created_at' => '2022-11-19 05:00:00']))
2022-11-18 22:34:50 +01:00
->has(Payment::factory()->notPaid()->nr('2019')->subscription('Free', 1050))
2022-11-18 15:55:44 +01:00
->defaults()->create(['firstname' => 'Max']);
$response = $this->get("/member/{$member->id}");
$this->assertInertiaHas('Max', $response, 'data.firstname');
$this->assertInertiaHas([
'activity_name' => '€ LeiterIn',
'id' => $member->memberships->first()->id,
'human_date' => '19.11.2022',
], $response, 'data.memberships.0');
2022-11-18 22:34:50 +01:00
$this->assertInertiaHas([
'subscription' => [
'name' => 'Free',
'id' => $member->payments->first()->subscription->id,
'amount' => 1050,
],
'status_name' => 'Nicht bezahlt',
'nr' => '2019',
], $response, 'data.payments.0');
2022-11-18 15:55:44 +01:00
}
}