From 1fb2dd19e71de103a9bd49737f3626d315420de2 Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Mon, 16 Oct 2023 12:36:56 +0200 Subject: [PATCH] Rename Group actions --- .../{ApiListAction.php => ListForGroupAction.php} | 2 +- .../{SyncAction.php => StoreForGroupAction.php} | 2 +- routes/web.php | 8 ++++---- tests/EndToEnd/SyncActionTest.php | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) rename app/Membership/Actions/{ApiListAction.php => ListForGroupAction.php} (95%) rename app/Membership/Actions/{SyncAction.php => StoreForGroupAction.php} (99%) diff --git a/app/Membership/Actions/ApiListAction.php b/app/Membership/Actions/ListForGroupAction.php similarity index 95% rename from app/Membership/Actions/ApiListAction.php rename to app/Membership/Actions/ListForGroupAction.php index 0b16c59f..02263d29 100644 --- a/app/Membership/Actions/ApiListAction.php +++ b/app/Membership/Actions/ListForGroupAction.php @@ -7,7 +7,7 @@ use Illuminate\Http\JsonResponse; use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\Concerns\AsAction; -class ApiListAction +class ListForGroupAction { use AsAction; diff --git a/app/Membership/Actions/SyncAction.php b/app/Membership/Actions/StoreForGroupAction.php similarity index 99% rename from app/Membership/Actions/SyncAction.php rename to app/Membership/Actions/StoreForGroupAction.php index 15c12c30..f4add875 100644 --- a/app/Membership/Actions/SyncAction.php +++ b/app/Membership/Actions/StoreForGroupAction.php @@ -15,7 +15,7 @@ use Illuminate\Support\Facades\DB; use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\Concerns\AsAction; -class SyncAction +class StoreForGroupAction { use AsAction; use TracksJob; diff --git a/routes/web.php b/routes/web.php index fccb82a0..531ee3ab 100644 --- a/routes/web.php +++ b/routes/web.php @@ -36,11 +36,11 @@ use App\Member\Actions\MemberShowAction; use App\Member\Actions\SearchAction; use App\Member\MemberController; use App\Membership\Actions\ApiIndexAction; -use App\Membership\Actions\ApiListAction; +use App\Membership\Actions\ListForGroupAction; use App\Membership\Actions\MembershipDestroyAction; use App\Membership\Actions\MembershipStoreAction; use App\Membership\Actions\MembershipUpdateAction; -use App\Membership\Actions\SyncAction; +use App\Membership\Actions\StoreForGroupAction; use App\Payment\Actions\AllpaymentPageAction; use App\Payment\Actions\AllpaymentStoreAction; use App\Payment\Actions\ApiIndexAction as PaymentApiIndexAction; @@ -111,7 +111,7 @@ Route::group(['middleware' => 'auth:web'], function (): void { Route::post('/member/{member}/membership', MembershipStoreAction::class)->name('member.membership.store'); Route::patch('/membership/{membership}', MembershipUpdateAction::class)->name('membership.update'); Route::delete('/membership/{membership}', MembershipDestroyAction::class)->name('membership.destroy'); - Route::post('/api/membership/member-list', ApiListAction::class)->name('membership.member-list'); - Route::post('/api/membership/sync', SyncAction::class)->name('membership.sync'); + Route::post('/api/membership/member-list', ListForGroupAction::class)->name('membership.member-list'); + Route::post('/api/membership/sync', StoreForGroupAction::class)->name('membership.sync'); Route::post('/api/member/{member}/membership', ApiIndexAction::class)->name('member.membership.index'); }); diff --git a/tests/EndToEnd/SyncActionTest.php b/tests/EndToEnd/SyncActionTest.php index c0bacfe1..26c1ae85 100644 --- a/tests/EndToEnd/SyncActionTest.php +++ b/tests/EndToEnd/SyncActionTest.php @@ -9,7 +9,7 @@ use App\Member\Member; use App\Member\Membership; use App\Membership\Actions\MembershipDestroyAction; use App\Membership\Actions\MembershipStoreAction; -use App\Membership\Actions\SyncAction; +use App\Membership\Actions\StoreForGroupAction; use App\Subactivity; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Support\Facades\Queue; @@ -37,7 +37,7 @@ class SyncActionTest extends TestCase 'subactivity_id' => $subactivity->id, 'group_id' => $group->id, ]); - SyncAction::assertPushed(fn ($action, $params) => $params[0]->is($group) && $params[1]->is($activity) && $params[2]->is($subactivity) && $params[3][0] === $member->id); + StoreForGroupAction::assertPushed(fn ($action, $params) => $params[0]->is($group) && $params[1]->is($activity) && $params[2]->is($subactivity) && $params[3][0] === $member->id); } public function testItCreatesAMembership(): void @@ -49,7 +49,7 @@ class SyncActionTest extends TestCase $subactivity = Subactivity::factory()->create(); $group = Group::factory()->create(); - SyncAction::run($group, $activity, $subactivity, [$member->id]); + StoreForGroupAction::run($group, $activity, $subactivity, [$member->id]); } public function testItDeletesAMembership(): void @@ -60,7 +60,7 @@ class SyncActionTest extends TestCase $member = Member::factory()->defaults()->has(Membership::factory()->inLocal('Leiter*in', 'Rover'))->create(); - SyncAction::run($member->memberships->first()->group, $member->memberships->first()->activity, $member->memberships->first()->subactivity, []); + StoreForGroupAction::run($member->memberships->first()->group, $member->memberships->first()->activity, $member->memberships->first()->subactivity, []); } public function testItRollsbackWhenDeletionFails(): void @@ -78,7 +78,7 @@ class SyncActionTest extends TestCase ->create(); try { - SyncAction::run($member->memberships->first()->group, $member->memberships->first()->activity, $member->memberships->first()->subactivity, []); + StoreForGroupAction::run($member->memberships->first()->group, $member->memberships->first()->activity, $member->memberships->first()->subactivity, []); } catch (Throwable $e) { } $this->assertDatabaseCount('memberships', 2);