Lint Member Store Test

This commit is contained in:
philipp lang 2024-03-08 22:59:43 +01:00
parent 4445304ef3
commit 32cc9feee0
1 changed files with 15 additions and 8 deletions

View File

@ -2,7 +2,10 @@
namespace Tests\Feature\Member; namespace Tests\Feature\Member;
use App\Actions\PullMemberAction;
use App\Actions\PullMembershipsAction;
use App\Activity; use App\Activity;
use App\Confession;
use App\Country; use App\Country;
use App\Fee; use App\Fee;
use App\Gender; use App\Gender;
@ -15,6 +18,7 @@ use App\Subactivity;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\Lib\MergesAttributes; use Tests\Lib\MergesAttributes;
use Tests\TestCase; use Tests\TestCase;
use Zoomyboy\LaravelNami\Fakes\MemberFake;
class StoreTest extends TestCase class StoreTest extends TestCase
{ {
@ -23,16 +27,19 @@ class StoreTest extends TestCase
public function testItCanStoreAMember(): void public function testItCanStoreAMember(): void
{ {
app(MemberFake::class)->stores(55, 103);
Fee::factory()->create(); Fee::factory()->create();
$this->withoutExceptionHandling()->login()->loginNami(); $this->withoutExceptionHandling()->login()->loginNami();
$country = Country::factory()->create(); $country = Country::factory()->create();
$gender = Gender::factory()->create(); $gender = Gender::factory()->create();
$region = Region::factory()->create(); $region = Region::factory()->create();
$nationality = Nationality::factory()->create(); $nationality = Nationality::factory()->create();
$activity = Activity::factory()->create(); $activity = Activity::factory()->inNami(89)->create();
$subactivity = Subactivity::factory()->create(); $subactivity = Subactivity::factory()->inNami(90)->create();
$subscription = Subscription::factory()->create(); $subscription = Subscription::factory()->create();
NamiPutMemberAction::allowToRun(); $confesstion = Confession::factory()->create(['is_null' => true]);
PullMemberAction::shouldRun();
PullMembershipsAction::shouldRun();
$response = $this $response = $this
->from('/member/create') ->from('/member/create')
@ -75,11 +82,11 @@ class StoreTest extends TestCase
'salutation' => 'Doktor', 'salutation' => 'Doktor',
'comment' => 'Lorem bla', 'comment' => 'Lorem bla',
]); ]);
NamiPutMemberAction::spy()->shouldHaveReceived('handle')->withArgs(
fn (Member $memberParam, Activity $activityParam, Subactivity $subactivityParam) => $memberParam->is($member) app(MemberFake::class)->assertStored(55, [
&& $activityParam->is($activity) 'ersteTaetigkeitId' => 89,
&& $subactivityParam->is($subactivity) 'ersteUntergliederungId' => 90,
)->once(); ]);
} }
public function testItCanStoreAMemberWithoutNami(): void public function testItCanStoreAMemberWithoutNami(): void