From 407338d4314d026c018fe7ed41be12f87ef9aa0a Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Tue, 21 Feb 2023 13:06:19 +0100 Subject: [PATCH] Fixed MembershipStoreAction --- app/Membership/Actions/MembershipStoreAction.php | 2 ++ tests/Feature/Membership/StoreTest.php | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/app/Membership/Actions/MembershipStoreAction.php b/app/Membership/Actions/MembershipStoreAction.php index dbccb97e..3a7bcbd4 100644 --- a/app/Membership/Actions/MembershipStoreAction.php +++ b/app/Membership/Actions/MembershipStoreAction.php @@ -68,6 +68,7 @@ class MembershipStoreAction 'activity_id' => ['bail', 'required', 'exists:activities,id'], 'subactivity_id' => $subactivityRule, 'promised_at' => ['nullable', 'date'], + 'group_id' => ['required', 'exists:groups,id'], ]; } @@ -79,6 +80,7 @@ class MembershipStoreAction return [ 'activity_id' => 'Tätigkeit', 'subactivity_id' => 'Untertätigkeit', + 'group_id' => 'Gruppierung', ]; } diff --git a/tests/Feature/Membership/StoreTest.php b/tests/Feature/Membership/StoreTest.php index de2715fc..251b39da 100644 --- a/tests/Feature/Membership/StoreTest.php +++ b/tests/Feature/Membership/StoreTest.php @@ -179,6 +179,18 @@ class StoreTest extends TestCase ]); } + public function testGroupIsRequired(): void + { + $member = Member::factory()->defaults()->for(Group::factory()->inNami(1400))->inNami(6)->create(); + + $response = $this->post( + "/member/{$member->id}/membership", + [], + ); + + $response->assertSessionHasErrors(['group_id' => 'Gruppierung ist erforderlich.']); + } + public function testSubactivityCanBeEmpty(): void { $this->withoutExceptionHandling();