login()->loginNami(); } public function testItUpdatesAMembership(): void { $this->withoutExceptionHandling(); $activity = Activity::factory()->hasAttached(Subactivity::factory())->create(); $member = Member::factory() ->defaults() ->has(Membership::factory()->for($activity)->for($activity->subactivities->first())) ->for(Group::factory()->inNami(1400)) ->inNami(6) ->create(); $membership = $member->memberships->first(); $response = $this->from('/member')->patch( "/member/{$member->id}/membership/{$membership->id}", MembershipRequestFactory::new()->promise(now())->in($membership->activity, $membership->subactivity)->create() ); $response->assertRedirect('/member'); $this->assertDatabaseHas('memberships', [ 'member_id' => $member->id, 'activity_id' => $activity->id, 'subactivity_id' => $activity->subactivities->first()->id, 'promised_at' => now()->format('Y-m-d'), ]); } }