fixed tests

This commit is contained in:
philipp lang 2022-11-16 23:52:38 +01:00
parent 0b344a2ec4
commit 7cefdecd2f
7 changed files with 56 additions and 20 deletions

View File

@ -0,0 +1,29 @@
<?php
namespace App\Initialize;
use DB;
use Zoomyboy\LaravelNami\Api;
class InitializeActivities
{
private Api $api;
public function __construct(Api $api)
{
$this->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();
}
}

View File

@ -15,6 +15,7 @@ class Initializer
InitializeGroups::class, InitializeGroups::class,
InitializeNationalities::class, InitializeNationalities::class,
InitializeFees::class, InitializeFees::class,
InitializeActivities::class,
InitializeConfessions::class, InitializeConfessions::class,
InitializeCountries::class, InitializeCountries::class,
InitializeGenders::class, InitializeGenders::class,

11
phpstan-baseline.neon Normal file
View File

@ -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

View File

@ -260,11 +260,6 @@ parameters:
count: 1 count: 1
path: app/Member/Member.php 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\\.$#" message: "#^Property App\\\\Member\\\\MemberController\\:\\:\\$filter type has no value type specified in iterable type array\\.$#"
count: 1 count: 1
@ -295,11 +290,6 @@ parameters:
count: 1 count: 1
path: app/Membership/MembershipResource.php 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\\.$#" message: "#^Method App\\\\Payment\\\\PaymentResource\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1 count: 1
@ -464,11 +454,6 @@ parameters:
count: 1 count: 1
path: tests/Feature/Pdf/GenerateTest.php 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\\-string\\> \\$class\\)\\: Unexpected token \"\\<\", expected type at offset 18$#" message: "#^PHPDoc tag @param has invalid value \\(\\<class\\-string\\> \\$class\\)\\: Unexpected token \"\\<\", expected type at offset 18$#"
count: 1 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\\.$#" message: "#^Property Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PushMemberTest\\:\\:\\$attributes type has no value type specified in iterable type array\\.$#"
count: 1 count: 1
path: packages/laravel-nami/tests/Unit/PushMemberTest.php 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

View File

@ -110,8 +110,8 @@ class IndexTest extends TestCase
$response = $this->get('/member'); $response = $this->get('/member');
$this->assertInertiaHas([ $this->assertInertiaHas([
'activity' => $member->memberships->first()->activity_id, 'activity_id' => $member->memberships->first()->activity_id,
'subactivity' => $member->memberships->first()->subactivity_id, 'subactivity_id' => $member->memberships->first()->subactivity_id,
'activity_name' => '€ Mitglied', 'activity_name' => '€ Mitglied',
'subactivity_name' => 'Wölfling', 'subactivity_name' => 'Wölfling',
'human_date' => '02.11.2022', 'human_date' => '02.11.2022',

View File

@ -127,7 +127,7 @@ class StoreTest extends TestCase
$nationality = Nationality::factory()->create(); $nationality = Nationality::factory()->create();
$subscription = Subscription::factory()->create(); $subscription = Subscription::factory()->create();
$billKind = BillKind::factory()->create(); $billKind = BillKind::factory()->create();
$activity = Activity::factory()->create(); $activity = Activity::factory()->create(['name' => '€ Mitglied']);
$subactivity = Subactivity::factory()->create(); $subactivity = Subactivity::factory()->create();
$response = $this $response = $this

View File

@ -2,16 +2,16 @@
namespace Tests\Feature\Member; namespace Tests\Feature\Member;
use App\Activity;
use App\Confession; use App\Confession;
use App\Country; use App\Country;
use App\Enum\Activity;
use App\Enum\Subactivity;
use App\Fee; use App\Fee;
use App\Group; use App\Group;
use App\Member\Actions\NamiPutMemberAction; use App\Member\Actions\NamiPutMemberAction;
use App\Member\Member; use App\Member\Member;
use App\Nationality; use App\Nationality;
use App\Payment\Subscription; use App\Payment\Subscription;
use App\Subactivity;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Tests\TestCase; use Tests\TestCase;