diff --git a/app/Initialize/InitializeActivities.php b/app/Initialize/InitializeActivities.php new file mode 100644 index 00000000..f1fe452c --- /dev/null +++ b/app/Initialize/InitializeActivities.php @@ -0,0 +1,29 @@ +api = $api; + } + + public function handle(): void + { + $groupId = $this->api->groups()->first()->id; + app(ActivityCreator::class)->createFor($this->api, $groupId); + } + + public function restore(): void + { + DB::table('activity_subactivity')->delete(); + DB::table('activities')->delete(); + DB::table('subactivities')->delete(); + } +} diff --git a/app/Initialize/Initializer.php b/app/Initialize/Initializer.php index b8c172a3..bba23c5a 100644 --- a/app/Initialize/Initializer.php +++ b/app/Initialize/Initializer.php @@ -15,6 +15,7 @@ class Initializer InitializeGroups::class, InitializeNationalities::class, InitializeFees::class, + InitializeActivities::class, InitializeConfessions::class, InitializeCountries::class, InitializeGenders::class, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 00000000..baebd67a --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,11 @@ +parameters: + ignoreErrors: + - + message: "#^Access to an undefined property Zoomyboy\\\\LaravelNami\\\\Member\\:\\:\\$first_activity_id\\.$#" + count: 1 + path: packages/laravel-nami/src/Member.php + + - + message: "#^Access to an undefined property Zoomyboy\\\\LaravelNami\\\\Member\\:\\:\\$first_subactivity_id\\.$#" + count: 1 + path: packages/laravel-nami/src/Member.php diff --git a/phpstan.neon b/phpstan.neon index a2e92933..fc960dbd 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -260,11 +260,6 @@ parameters: count: 1 path: app/Member/Member.php - - - message: "#^Job class App\\\\Member\\\\DeleteJob constructor invoked with 2 parameters in App\\\\Member\\\\DeleteJob\\:\\:dispatch\\(\\), 1 required\\.$#" - count: 1 - path: app/Member/MemberController.php - - message: "#^Property App\\\\Member\\\\MemberController\\:\\:\\$filter type has no value type specified in iterable type array\\.$#" count: 1 @@ -295,11 +290,6 @@ parameters: count: 1 path: app/Membership/MembershipResource.php - - - message: "#^Method App\\\\Membership\\\\Requests\\\\StoreRequest\\:\\:rules\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: app/Membership/Requests/StoreRequest.php - - message: "#^Method App\\\\Payment\\\\PaymentResource\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -464,11 +454,6 @@ parameters: count: 1 path: tests/Feature/Pdf/GenerateTest.php - - - message: "#^Method Tests\\\\TestCase\\:\\:assertErrors\\(\\) has parameter \\$errors with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/TestCase.php - - message: "#^PHPDoc tag @param has invalid value \\(\\ \\$class\\)\\: Unexpected token \"\\<\", expected type at offset 18$#" count: 1 @@ -1153,3 +1138,13 @@ parameters: message: "#^Property Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PushMemberTest\\:\\:\\$attributes type has no value type specified in iterable type array\\.$#" count: 1 path: packages/laravel-nami/tests/Unit/PushMemberTest.php + + - + message: "#^Access to an undefined property Zoomyboy\\\\LaravelNami\\\\Member\\:\\:\\$first_activity_id\\.$#" + count: 1 + path: packages/laravel-nami/src/Member.php + + - + message: "#^Access to an undefined property Zoomyboy\\\\LaravelNami\\\\Member\\:\\:\\$first_subactivity_id\\.$#" + count: 1 + path: packages/laravel-nami/src/Member.php diff --git a/tests/Feature/Member/IndexTest.php b/tests/Feature/Member/IndexTest.php index 9294bfe9..8ce340eb 100644 --- a/tests/Feature/Member/IndexTest.php +++ b/tests/Feature/Member/IndexTest.php @@ -110,8 +110,8 @@ class IndexTest extends TestCase $response = $this->get('/member'); $this->assertInertiaHas([ - 'activity' => $member->memberships->first()->activity_id, - 'subactivity' => $member->memberships->first()->subactivity_id, + 'activity_id' => $member->memberships->first()->activity_id, + 'subactivity_id' => $member->memberships->first()->subactivity_id, 'activity_name' => '€ Mitglied', 'subactivity_name' => 'Wölfling', 'human_date' => '02.11.2022', diff --git a/tests/Feature/Member/StoreTest.php b/tests/Feature/Member/StoreTest.php index 68b6dc65..cf608446 100644 --- a/tests/Feature/Member/StoreTest.php +++ b/tests/Feature/Member/StoreTest.php @@ -127,7 +127,7 @@ class StoreTest extends TestCase $nationality = Nationality::factory()->create(); $subscription = Subscription::factory()->create(); $billKind = BillKind::factory()->create(); - $activity = Activity::factory()->create(); + $activity = Activity::factory()->create(['name' => '€ Mitglied']); $subactivity = Subactivity::factory()->create(); $response = $this diff --git a/tests/Feature/Member/UpdateTest.php b/tests/Feature/Member/UpdateTest.php index 109eb2e7..e84e637e 100644 --- a/tests/Feature/Member/UpdateTest.php +++ b/tests/Feature/Member/UpdateTest.php @@ -2,16 +2,16 @@ namespace Tests\Feature\Member; +use App\Activity; use App\Confession; use App\Country; -use App\Enum\Activity; -use App\Enum\Subactivity; use App\Fee; use App\Group; use App\Member\Actions\NamiPutMemberAction; use App\Member\Member; use App\Nationality; use App\Payment\Subscription; +use App\Subactivity; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\Http; use Tests\TestCase;