2022-11-16 23:39:44 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Member;
|
|
|
|
|
|
|
|
use App\Activity;
|
|
|
|
use App\Member\Member;
|
|
|
|
use App\Subactivity;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class EditTest extends TestCase
|
|
|
|
{
|
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
public function testItDisplaysEditPage(): void
|
|
|
|
{
|
|
|
|
$this->withoutExceptionHandling();
|
|
|
|
$this->login()->loginNami();
|
2023-02-27 23:15:57 +01:00
|
|
|
$member = Member::factory()->defaults()->create(['salutation' => 'Doktor', 'firstname' => 'Max', 'comment' => 'Lorem bla']);
|
2023-02-17 01:57:06 +01:00
|
|
|
$activity = Activity::factory()->inNami(66)->hasAttached(Subactivity::factory()->inNami(56)->name('Biber'))->name('€ Mitglied')->create();
|
2022-11-16 23:39:44 +01:00
|
|
|
$subactivity = $activity->subactivities->first();
|
|
|
|
|
|
|
|
$response = $this->get(route('member.edit', ['member' => $member]));
|
|
|
|
|
2023-05-03 00:25:04 +02:00
|
|
|
$this->assertInertiaHas('Biber', $response, "meta.formSubactivities.{$activity->id}.{$subactivity->id}");
|
|
|
|
$this->assertInertiaHas('€ Mitglied', $response, "meta.formActivities.{$activity->id}");
|
2022-11-16 23:39:44 +01:00
|
|
|
$this->assertInertiaHas('Max', $response, 'data.firstname');
|
2023-02-27 22:40:47 +01:00
|
|
|
$this->assertInertiaHas('Doktor', $response, 'data.salutation');
|
2023-02-27 23:15:57 +01:00
|
|
|
$this->assertInertiaHas('Lorem bla', $response, 'data.comment');
|
2022-11-16 23:39:44 +01:00
|
|
|
$this->assertInertiaHas('edit', $response, 'mode');
|
|
|
|
$this->assertInertiaHas(false, $response, 'conflict');
|
2023-05-03 00:25:04 +02:00
|
|
|
$this->assertInertiaHas(['name' => 'E-Mail', 'id' => 'E-Mail'], $response, 'meta.billKinds.0');
|
2022-11-16 23:39:44 +01:00
|
|
|
}
|
2022-11-22 00:37:34 +01:00
|
|
|
|
|
|
|
public function testItDisplaysEducation(): void
|
|
|
|
{
|
|
|
|
$this->withoutExceptionHandling()->login()->loginNami();
|
|
|
|
$member = Member::factory()
|
|
|
|
->defaults()
|
|
|
|
->create([
|
|
|
|
'efz' => '2022-09-20',
|
|
|
|
'ps_at' => '2022-04-20',
|
|
|
|
'more_ps_at' => '2022-06-02',
|
|
|
|
'without_education_at' => '2022-06-03',
|
|
|
|
'without_efz_at' => '2022-06-04',
|
2023-11-24 13:28:54 +01:00
|
|
|
'recertified_at' => '2022-06-04',
|
2022-11-22 00:37:34 +01:00
|
|
|
'has_vk' => true,
|
|
|
|
'has_svk' => true,
|
|
|
|
'multiply_pv' => true,
|
|
|
|
'multiply_more_pv' => true,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$response = $this->get(route('member.edit', ['member' => $member]));
|
|
|
|
|
|
|
|
$this->assertInertiaHas([
|
|
|
|
'efz' => '2022-09-20',
|
|
|
|
'ps_at' => '2022-04-20',
|
|
|
|
'more_ps_at' => '2022-06-02',
|
|
|
|
'without_education_at' => '2022-06-03',
|
|
|
|
'without_efz_at' => '2022-06-04',
|
2023-11-24 13:28:54 +01:00
|
|
|
'recertified_at' => '2022-06-04',
|
2022-11-22 00:37:34 +01:00
|
|
|
'has_vk' => true,
|
|
|
|
'has_svk' => true,
|
|
|
|
'multiply_pv' => true,
|
|
|
|
'multiply_more_pv' => true,
|
|
|
|
], $response, 'data');
|
|
|
|
}
|
2022-12-06 23:20:05 +01:00
|
|
|
|
|
|
|
public function testItDisplaysSystem(): void
|
|
|
|
{
|
|
|
|
$this->withoutExceptionHandling()->login()->loginNami();
|
|
|
|
$member = Member::factory()
|
|
|
|
->defaults()
|
|
|
|
->emailBillKind()
|
|
|
|
->create();
|
|
|
|
|
|
|
|
$response = $this->get(route('member.edit', ['member' => $member]));
|
|
|
|
|
|
|
|
$this->assertInertiaHas([
|
|
|
|
'bill_kind' => 'E-Mail',
|
|
|
|
], $response, 'data');
|
|
|
|
}
|
2022-11-16 23:39:44 +01:00
|
|
|
}
|