Compare commits
2 Commits
ef70203c8a
...
4b4d073ea2
Author | SHA1 | Date |
---|---|---|
philipp lang | 4b4d073ea2 | |
philipp lang | 565b1ffbce |
|
@ -4,38 +4,24 @@ namespace App\Member\Actions;
|
|||
|
||||
use App\Member\Member;
|
||||
use App\Member\MemberResource;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class MemberShowAction
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
/**
|
||||
* @return array{data: MemberResource}
|
||||
*/
|
||||
public function handle(Member $member): array
|
||||
public function asController(Member $member): JsonResponse
|
||||
{
|
||||
return [
|
||||
'data' => new MemberResource(
|
||||
$member
|
||||
->load('memberships')
|
||||
->load('invoicePositions.invoice')
|
||||
->load('nationality')
|
||||
->load('region')
|
||||
->load('subscription')
|
||||
->load('courses.course')
|
||||
),
|
||||
return response()->json([
|
||||
'data' => new MemberResource($member
|
||||
->load('memberships')
|
||||
->load('invoicePositions.invoice')
|
||||
->load('nationality')
|
||||
->load('region')
|
||||
->load('subscription')
|
||||
->load('courses.course')),
|
||||
'meta' => MemberResource::meta(),
|
||||
];
|
||||
}
|
||||
|
||||
public function asController(Member $member): Response
|
||||
{
|
||||
session()->put('menu', 'member');
|
||||
session()->put('title', 'Mitglied ' . $member->fullname);
|
||||
|
||||
return Inertia::render('member/ShowView', $this->handle($member));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,17 +27,6 @@ class MemberController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function create(): Response
|
||||
{
|
||||
session()->put('menu', 'member');
|
||||
session()->put('title', 'Mitglied erstellen');
|
||||
|
||||
return Inertia::render('member/VForm', [
|
||||
'mode' => 'create',
|
||||
'meta' => MemberResource::meta(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(MemberRequest $request, NamiSettings $settings): RedirectResponse
|
||||
{
|
||||
$request->persistCreate($settings);
|
||||
|
@ -45,19 +34,6 @@ class MemberController extends Controller
|
|||
return redirect()->route('member.index');
|
||||
}
|
||||
|
||||
public function edit(Member $member, Request $request): Response
|
||||
{
|
||||
session()->put('menu', 'member');
|
||||
session()->put('title', "Mitglied {$member->firstname} {$member->lastname} bearbeiten");
|
||||
|
||||
return Inertia::render('member/VForm', [
|
||||
'data' => new MemberResource($member),
|
||||
'mode' => 'edit',
|
||||
'conflict' => '1' === $request->query('conflict', '0'),
|
||||
'meta' => MemberResource::meta(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Member $member, MemberRequest $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
<v-notification class="fixed z-40 right-0 bottom-0 mb-3 mr-3"></v-notification>
|
||||
|
||||
<!-- ******************************** Sidebar ******************************** -->
|
||||
<div class="fixed z-40 bg-gray-800 p-6 w-56 top-0 h-screen border-r border-gray-600 border-solid flex flex-col justify-between transition-all"
|
||||
<div
|
||||
class="fixed z-40 bg-gray-800 p-6 w-56 top-0 h-screen border-r border-gray-600 border-solid flex flex-col justify-between transition-all"
|
||||
:class="{
|
||||
'-left-[14rem]': !menuStore.isShifted,
|
||||
'left-0': menuStore.isShifted,
|
||||
}">
|
||||
}"
|
||||
>
|
||||
<div class="grid gap-2">
|
||||
<v-link href="/" menu="dashboard" icon="loss">Dashboard</v-link>
|
||||
<v-link href="/member" menu="member" icon="user">Mitglieder</v-link>
|
||||
|
@ -38,7 +40,7 @@
|
|||
|
||||
<script>
|
||||
import VLink from './_VLink.vue';
|
||||
import { menuStore } from '../stores/menuStore.js';
|
||||
import {menuStore} from '../stores/menuStore.js';
|
||||
import VNotification from '../components/VNotification.vue';
|
||||
|
||||
export default {
|
||||
|
|
|
@ -90,7 +90,7 @@ Route::group(['middleware' => 'auth:web'], function (): void {
|
|||
Route::post('/nami/search', NamiSearchAction::class)->name('nami.search');
|
||||
Route::get('/initialize', InitializeFormAction::class)->name('initialize.form');
|
||||
Route::post('/initialize', InitializeAction::class)->name('initialize.store');
|
||||
Route::resource('member', MemberController::class)->except('show', 'destroy');
|
||||
Route::resource('member', MemberController::class)->except('show', 'destroy', 'edit', 'create');
|
||||
Route::delete('/member/{member}', MemberDeleteAction::class);
|
||||
Route::get('/member/{member}', MemberShowAction::class)->name('member.show');
|
||||
Route::resource('subscription', SubscriptionController::class);
|
||||
|
|
|
@ -3,15 +3,22 @@
|
|||
namespace Tests\EndToEnd\Member;
|
||||
|
||||
use App\Activity;
|
||||
use App\Country;
|
||||
use App\Group;
|
||||
use App\Member\Member;
|
||||
use App\Member\Membership;
|
||||
use App\Subactivity;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Tests\EndToEndTestCase;
|
||||
|
||||
class IndexTest extends EndToEndTestCase
|
||||
{
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Country::factory()->create(['name' => 'Deutschland']);
|
||||
}
|
||||
|
||||
public function testItGetsMembers(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
|
|
|
@ -36,9 +36,11 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
->assertInertiaCount('data.data', 1);
|
||||
}
|
||||
|
||||
public function testItGetsDefaultCountryFromDefaultModel(): void
|
||||
public function testItGetsDefault(): void
|
||||
{
|
||||
$this->callFilter('member.index', [])->assertInertiaPath('data.meta.default.country_id', Country::firstWhere('name', 'Deutschland')->id);
|
||||
$this->callFilter('member.index', [])
|
||||
->assertInertiaPath('data.meta.default.country_id', Country::firstWhere('name', 'Deutschland')->id)
|
||||
->assertInertiaPath('data.meta.default.address', '');
|
||||
}
|
||||
|
||||
public function testItHandlesAddress(): void
|
||||
|
@ -264,4 +266,24 @@ class MemberIndexTest extends EndToEndTestCase
|
|||
$this->callFilter('member.index', ['hasBirthday' => false, 'exclude' => [$member->id]])
|
||||
->assertInertiaCount('data.data', 0);
|
||||
}
|
||||
|
||||
public function testItDisplaysActivityMeta(): void
|
||||
{
|
||||
$activity = Activity::factory()->inNami(5)->hasAttached(Subactivity::factory()->inNami(23)->name('Biber'))->name('€ Mitglied')->create();
|
||||
$subactivity = $activity->subactivities->first();
|
||||
|
||||
$this->callFilter('member.index', [])
|
||||
->assertInertiaPath("data.meta.formSubactivities.{$activity->id}.{$subactivity->id}", 'Biber')
|
||||
->assertInertiaPath("data.meta.formActivities.{$activity->id}", '€ Mitglied')
|
||||
->assertInertiaPath('data.meta.billKinds.0', ['id' => 'E-Mail', 'name' => 'E-Mail']);
|
||||
}
|
||||
|
||||
public function testItDoesntDisplayActivitiesAndSubactivitiesNotInNami(): void
|
||||
{
|
||||
Activity::factory()->hasAttached(Subactivity::factory()->name('Biber'))->name('€ Mitglied')->create();
|
||||
|
||||
$this->callFilter('member.index', [])
|
||||
->assertInertiaCount('data.meta.formCreateSubactivities', 0)
|
||||
->assertInertiaCount('data.meta.formCreateActivities', 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Member;
|
||||
|
||||
use App\Activity;
|
||||
use App\Country;
|
||||
use App\Subactivity;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CreateTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
$this->login()->loginNami();
|
||||
Country::factory()->create(['name' => 'Deutschland']);
|
||||
}
|
||||
|
||||
public function testItDisplaysCreatePage(): void
|
||||
{
|
||||
$activity = Activity::factory()->inNami(5)->hasAttached(Subactivity::factory()->inNami(23)->name('Biber'))->name('€ Mitglied')->create();
|
||||
$subactivity = $activity->subactivities->first();
|
||||
|
||||
$response = $this->get(route('member.create'));
|
||||
|
||||
$this->assertInertiaHas('Biber', $response, "meta.formSubactivities.{$activity->id}.{$subactivity->id}");
|
||||
$this->assertInertiaHas('€ Mitglied', $response, "meta.formActivities.{$activity->id}");
|
||||
$this->assertInertiaHas(['name' => 'E-Mail', 'id' => 'E-Mail'], $response, 'meta.billKinds.0');
|
||||
|
||||
$this->assertInertiaHas([
|
||||
'efz' => null,
|
||||
'ps_at' => null,
|
||||
'more_ps_at' => null,
|
||||
'without_education_at' => null,
|
||||
'without_efz_at' => null,
|
||||
'address' => '',
|
||||
], $response, 'data');
|
||||
}
|
||||
|
||||
public function testItDoesntDisplayActivitiesAndSubactivitiesNotInNami(): void
|
||||
{
|
||||
Activity::factory()->hasAttached(Subactivity::factory()->name('Biber'))->name('€ Mitglied')->create();
|
||||
|
||||
$response = $this->get(route('member.create'));
|
||||
|
||||
$this->assertCount(0, $this->inertia($response, 'meta.formCreateSubactivities'));
|
||||
$this->assertCount(0, $this->inertia($response, 'meta.formCreateActivities'));
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
<?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();
|
||||
$member = Member::factory()->defaults()->create(['salutation' => 'Doktor', 'firstname' => 'Max', 'comment' => 'Lorem bla']);
|
||||
$activity = Activity::factory()->inNami(66)->hasAttached(Subactivity::factory()->inNami(56)->name('Biber'))->name('€ Mitglied')->create();
|
||||
$subactivity = $activity->subactivities->first();
|
||||
|
||||
$response = $this->get(route('member.edit', ['member' => $member]));
|
||||
|
||||
$this->assertInertiaHas('Biber', $response, "meta.formSubactivities.{$activity->id}.{$subactivity->id}");
|
||||
$this->assertInertiaHas('€ Mitglied', $response, "meta.formActivities.{$activity->id}");
|
||||
$this->assertInertiaHas('Max', $response, 'data.firstname');
|
||||
$this->assertInertiaHas('Doktor', $response, 'data.salutation');
|
||||
$this->assertInertiaHas('Lorem bla', $response, 'data.comment');
|
||||
$this->assertInertiaHas('edit', $response, 'mode');
|
||||
$this->assertInertiaHas(false, $response, 'conflict');
|
||||
$this->assertInertiaHas(['name' => 'E-Mail', 'id' => 'E-Mail'], $response, 'meta.billKinds.0');
|
||||
}
|
||||
|
||||
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',
|
||||
'recertified_at' => '2022-06-04',
|
||||
'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',
|
||||
'recertified_at' => '2022-06-04',
|
||||
'has_vk' => true,
|
||||
'has_svk' => true,
|
||||
'multiply_pv' => true,
|
||||
'multiply_more_pv' => true,
|
||||
], $response, 'data');
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
namespace Tests\Feature\Member;
|
||||
|
||||
use App\Activity;
|
||||
use App\Country;
|
||||
use App\Course\Models\Course;
|
||||
use App\Course\Models\CourseMember;
|
||||
use App\Fee;
|
||||
use App\Gender;
|
||||
use App\Group;
|
||||
use App\Invoice\Models\Invoice;
|
||||
|
@ -12,19 +13,24 @@ use App\Invoice\Models\InvoicePosition;
|
|||
use App\Member\Member;
|
||||
use App\Member\Membership;
|
||||
use App\Nationality;
|
||||
use App\Payment\Payment;
|
||||
use App\Payment\Subscription;
|
||||
use App\Region;
|
||||
use App\Subactivity;
|
||||
use Carbon\Carbon;
|
||||
use Generator;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\RequestFactories\Child;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ShowTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Country::factory()->create(['name' => 'Deutschland']);
|
||||
}
|
||||
|
||||
public function testItShowsSingleMember(): void
|
||||
{
|
||||
Carbon::setTestNow(Carbon::parse('2006-01-01 15:00:00'));
|
||||
|
@ -71,70 +77,58 @@ class ShowTest extends TestCase
|
|||
'mitgliedsnr' => 998,
|
||||
'lon' => 19.05,
|
||||
'lat' => 14.053,
|
||||
'comment' => 'Lorem bla'
|
||||
]);
|
||||
|
||||
$response = $this->get("/member/{$member->id}");
|
||||
|
||||
$this->assertInertiaHas([
|
||||
'birthday_human' => '20.04.1991',
|
||||
'age' => 14,
|
||||
'group_name' => 'Stamm Beispiel',
|
||||
'full_address' => 'Itterstr 3, 42719 Solingen',
|
||||
'region' => ['name' => 'NRW'],
|
||||
'other_country' => 'other',
|
||||
'main_phone' => '+49 212 1266775',
|
||||
'mobile_phone' => '+49 212 1266776',
|
||||
'work_phone' => '+49 212 1266777',
|
||||
'children_phone' => '+49 212 1266778',
|
||||
'email' => 'a@b.de',
|
||||
'email_parents' => 'b@c.de',
|
||||
'fax' => '+49 212 1255674',
|
||||
'fullname' => 'Herr Max Muster',
|
||||
'efz_human' => '20.09.2022',
|
||||
'ps_at_human' => '20.04.2022',
|
||||
'more_ps_at_human' => '02.06.2022',
|
||||
'without_education_at_human' => '03.06.2022',
|
||||
'without_efz_at_human' => '04.06.2022',
|
||||
'recertified_at_human' => '13.06.2022',
|
||||
'has_vk' => true,
|
||||
'has_svk' => true,
|
||||
'multiply_pv' => true,
|
||||
'multiply_more_pv' => true,
|
||||
'has_nami' => true,
|
||||
'nami_id' => 123,
|
||||
'send_newspaper' => true,
|
||||
'joined_at_human' => '11.06.2022',
|
||||
'bill_kind_name' => 'Post',
|
||||
'mitgliedsnr' => 998,
|
||||
'lon' => 19.05,
|
||||
'lat' => 14.053,
|
||||
'subscription' => [
|
||||
'name' => 'Sub',
|
||||
],
|
||||
], $response, 'data');
|
||||
$this->assertInertiaHas([
|
||||
'activity_name' => '€ LeiterIn',
|
||||
'subactivity_name' => 'Jungpfadfinder',
|
||||
'id' => $member->memberships->first()->id,
|
||||
'human_date' => '19.11.2022',
|
||||
'promised_at' => now()->format('Y-m-d'),
|
||||
], $response, 'data.memberships.0');
|
||||
$this->assertInertiaHas([
|
||||
'organizer' => 'DPSG',
|
||||
'event_name' => 'Wochenende',
|
||||
'completed_at_human' => '03.03.2022',
|
||||
'course' => [
|
||||
'name' => ' Baustein 2e - Gewalt gegen Kinder und Jugendliche: Vertiefung, Prävention ',
|
||||
'short_name' => '2e',
|
||||
],
|
||||
], $response, 'data.courses.0');
|
||||
$this->assertInertiaHas([
|
||||
'description' => 'uu',
|
||||
'price_human' => '10,50 €',
|
||||
'invoice' => [
|
||||
'status' => 'Neu',
|
||||
]
|
||||
], $response, 'data.invoicePositions.0');
|
||||
$this->getJson(route('member.show', ['member' => $member]))
|
||||
->assertJsonPath('data.firstname', 'Max')
|
||||
->assertJsonPath('data.birthday_human', '20.04.1991')
|
||||
->assertJsonPath('data.age', 14)
|
||||
->assertJsonPath('data.group_name', 'Stamm Beispiel')
|
||||
->assertJsonPath('data.full_address', 'Itterstr 3, 42719 Solingen')
|
||||
->assertJsonPath('data.region.name', 'NRW')
|
||||
->assertJsonPath('data.other_country', 'other')
|
||||
->assertJsonPath('data.main_phone', '+49 212 1266775')
|
||||
->assertJsonPath('data.mobile_phone', '+49 212 1266776')
|
||||
->assertJsonPath('data.work_phone', '+49 212 1266777')
|
||||
->assertJsonPath('data.children_phone', '+49 212 1266778')
|
||||
->assertJsonPath('data.email', 'a@b.de')
|
||||
->assertJsonPath('data.email_parents', 'b@c.de')
|
||||
->assertJsonPath('data.fax', '+49 212 1255674')
|
||||
->assertJsonPath('data.fullname', 'Herr Max Muster')
|
||||
->assertJsonPath('data.efz_human', '20.09.2022')
|
||||
->assertJsonPath('data.ps_at_human', '20.04.2022')
|
||||
->assertJsonPath('data.more_ps_at_human', '02.06.2022')
|
||||
->assertJsonPath('data.without_education_at_human', '03.06.2022')
|
||||
->assertJsonPath('data.without_efz_at_human', '04.06.2022')
|
||||
->assertJsonPath('data.recertified_at_human', '13.06.2022')
|
||||
->assertJsonPath('data.has_vk', true)
|
||||
->assertJsonPath('data.has_svk', true)
|
||||
->assertJsonPath('data.multiply_pv', true)
|
||||
->assertJsonPath('data.multiply_more_pv', true)
|
||||
->assertJsonPath('data.has_nami', true)
|
||||
->assertJsonPath('data.nami_id', 123)
|
||||
->assertJsonPath('data.send_newspaper', true)
|
||||
->assertJsonPath('data.joined_at_human', '11.06.2022')
|
||||
->assertJsonPath('data.bill_kind_name', 'Post')
|
||||
->assertJsonPath('data.mitgliedsnr', 998)
|
||||
->assertJsonPath('data.lon', 19.05)
|
||||
->assertJsonPath('data.lat', 14.053)
|
||||
->assertJsonPath('data.subscription.name', 'Sub')
|
||||
->assertJsonPath('data.comment', 'Lorem bla')
|
||||
->assertJsonPath('data.memberships.0.activity_name', '€ LeiterIn')
|
||||
->assertJsonPath('data.memberships.0.subactivity_name', 'Jungpfadfinder')
|
||||
->assertJsonPath('data.memberships.0.id', $member->memberships->first()->id)
|
||||
->assertJsonPath('data.memberships.0.human_date', '19.11.2022')
|
||||
->assertJsonPath('data.memberships.0.promised_at', now()->format('Y-m-d'))
|
||||
->assertJsonPath('data.courses.0.organizer', 'DPSG')
|
||||
->assertJsonPath('data.courses.0.event_name', 'Wochenende')
|
||||
->assertJsonPath('data.courses.0.completed_at_human', '03.03.2022')
|
||||
->assertJsonPath('data.courses.0.course.name', ' Baustein 2e - Gewalt gegen Kinder und Jugendliche: Vertiefung, Prävention ')
|
||||
->assertJsonPath('data.courses.0.course.short_name', '2e')
|
||||
->assertJsonPath('data.invoicePositions.0.description', 'uu')
|
||||
->assertJsonPath('data.invoicePositions.0.price_human', '10,50 €')
|
||||
->assertJsonPath('data.invoicePositions.0.invoice.status', 'Neu');
|
||||
}
|
||||
|
||||
public function testItShowsMinimalSingleMember(): void
|
||||
|
@ -146,24 +140,14 @@ class ShowTest extends TestCase
|
|||
->for(Subscription::factory()->forFee())
|
||||
->create(['firstname' => 'Max', 'lastname' => 'Muster']);
|
||||
|
||||
$response = $this->get("/member/{$member->id}");
|
||||
|
||||
$this->assertInertiaHas([
|
||||
'region' => ['name' => '-- kein --'],
|
||||
'fullname' => 'Max Muster',
|
||||
'nationality' => [
|
||||
'name' => 'deutsch',
|
||||
],
|
||||
'efz_human' => null,
|
||||
'ps_at_human' => null,
|
||||
'more_ps_at_human' => null,
|
||||
'without_education_at_human' => null,
|
||||
'without_efz_at_human' => null,
|
||||
'has_vk' => false,
|
||||
'has_svk' => false,
|
||||
'multiply_pv' => false,
|
||||
'multiply_more_pv' => false,
|
||||
], $response, 'data');
|
||||
$this->get(route('member.show', ['member' => $member]))
|
||||
->assertJsonPath('data.has_vk', false)
|
||||
->assertJsonPath('data.has_svk', false)
|
||||
->assertJsonPath('data.multiply_pv', false)
|
||||
->assertJsonPath('data.multiply_more_pv', false)
|
||||
->assertJsonPath('data.nationality.name', 'deutsch')
|
||||
->assertJsonPath('data.region.name', '-- kein --')
|
||||
->assertJsonPath('data.fullname', 'Max Muster');
|
||||
}
|
||||
|
||||
public function membershipDataProvider(): Generator
|
||||
|
@ -184,8 +168,21 @@ class ShowTest extends TestCase
|
|||
->has(Membership::factory()->in('€ LeiterIn', 455, 'Pfadfinder', 15)->state(['from' => $from, 'to' => $to]))
|
||||
->create();
|
||||
|
||||
$response = $this->get("/member/{$member->id}");
|
||||
$this->get(route('member.show', ['member' => $member]))
|
||||
->assertJsonPath('data.memberships.0.is_active', $isActive);
|
||||
}
|
||||
|
||||
$this->assertInertiaHas($isActive, $response, 'data.memberships.0.is_active');
|
||||
public function testItDisplaysMeta(): void
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$this->login()->loginNami();
|
||||
$member = Member::factory()->defaults()->create(['salutation' => 'Doktor', 'firstname' => 'Max', 'comment' => 'Lorem bla']);
|
||||
$activity = Activity::factory()->inNami(66)->hasAttached(Subactivity::factory()->inNami(56)->name('Biber'))->name('€ Mitglied')->create();
|
||||
$subactivity = $activity->subactivities->first();
|
||||
|
||||
$this->get(route('member.show', ['member' => $member]))
|
||||
->assertJsonPath("meta.formActivities.{$activity->id}", '€ Mitglied')
|
||||
->assertJsonPath("meta.formSubactivities.{$activity->id}.{$subactivity->id}", 'Biber')
|
||||
->assertJsonPath("meta.billKinds.0", ['id' => 'E-Mail', 'name' => 'E-Mail']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue