From c21aa54e853f7d9169c636414b077183b0f88996 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 6 Feb 2023 01:08:39 +0100 Subject: [PATCH] Add memberships sync after member push --- app/Member/Actions/NamiPutMemberAction.php | 2 ++ tests/Feature/Member/NamiPutMemberActionTest.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Member/Actions/NamiPutMemberAction.php b/app/Member/Actions/NamiPutMemberAction.php index f27773e9..323f0d69 100644 --- a/app/Member/Actions/NamiPutMemberAction.php +++ b/app/Member/Actions/NamiPutMemberAction.php @@ -3,6 +3,7 @@ namespace App\Member\Actions; use App\Actions\PullMemberAction; +use App\Actions\PullMembershipsAction; use App\Activity; use App\Confession; use App\Member\Member; @@ -51,6 +52,7 @@ class NamiPutMemberAction Member::withoutEvents(function () use ($response, $member) { $member->update(['nami_id' => $response]); app(PullMemberAction::class)->handle($member->group->nami_id, $member->nami_id); + app(PullMembershipsAction::class)->handle($member); }); } } diff --git a/tests/Feature/Member/NamiPutMemberActionTest.php b/tests/Feature/Member/NamiPutMemberActionTest.php index 2da1f705..18c515fd 100644 --- a/tests/Feature/Member/NamiPutMemberActionTest.php +++ b/tests/Feature/Member/NamiPutMemberActionTest.php @@ -3,6 +3,7 @@ namespace Tests\Feature\Member; use App\Actions\PullMemberAction; +use App\Actions\PullMembershipsAction; use App\Activity; use App\Confession; use App\Country; @@ -27,6 +28,8 @@ class NamiPutMemberActionTest extends TestCase public function testItPutsAMember(): void { Fee::factory()->create(); + $this->stubIo(PullMemberAction::class, fn ($mock) => $mock); + $this->stubIo(PullMembershipsAction::class, fn ($mock) => $mock); $this->withoutExceptionHandling()->login()->loginNami(); $country = Country::factory()->create(); $gender = Gender::factory()->create(); @@ -36,7 +39,6 @@ class NamiPutMemberActionTest extends TestCase $group = Group::factory()->inNami(55)->create(); $confession = Confession::factory()->inNami(567)->create(['is_null' => true]); app(MemberFake::class)->createsSuccessfully(55, 993); - $this->stubIo(PullMemberAction::class, fn ($mock) => $mock); $activity = Activity::factory()->hasAttached(Subactivity::factory()->name('Biber')->inNami(55))->name('Leiter')->inNami(6)->create(); $subactivity = $activity->subactivities->first(); @@ -61,5 +63,6 @@ class NamiPutMemberActionTest extends TestCase 'nami_id' => 993, ]); Phake::verify(app(PullMemberAction::class))->handle(55, 993); + Phake::verify(app(PullMembershipsAction::class))->handle($member); } }