From 2a49f830147e7522f8fc26bc43822e69018680de Mon Sep 17 00:00:00 2001 From: philipp lang Date: Thu, 23 Feb 2023 01:11:05 +0100 Subject: [PATCH] fixed initialize members --- .../Feature/Initialize/InitializeMembersTest.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tests/Feature/Initialize/InitializeMembersTest.php b/tests/Feature/Initialize/InitializeMembersTest.php index 57eb45d6..7fb765cd 100644 --- a/tests/Feature/Initialize/InitializeMembersTest.php +++ b/tests/Feature/Initialize/InitializeMembersTest.php @@ -3,15 +3,12 @@ namespace Tests\Feature\Initialize; use App\Initialize\InitializeMembers; -use App\Member\Member; -use App\Nami\Api\CoursesOfAction; -use App\Nami\Api\MembershipsOfAction; +use App\Nami\Api\FullMemberAction; use App\Setting\NamiSettings; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Support\Facades\Artisan; use Tests\TestCase; use Zoomyboy\LaravelNami\Data\MemberEntry; -use Zoomyboy\LaravelNami\Fakes\MemberFake; use Zoomyboy\LaravelNami\Fakes\SearchFake; class InitializeMembersTest extends TestCase @@ -21,14 +18,11 @@ class InitializeMembersTest extends TestCase public function testItInitializesMembers(): void { $this->loginNami(); - $member = Member::factory()->defaults()->create(); $api = app(NamiSettings::class)->login(); app(SearchFake::class)->fetches(1, 0, [ MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]), ]); - app(MemberFake::class)->shows(100, 20); - MembershipsOfAction::shouldRun()->once()->withArgs(fn ($api, $id) => 20 === $id)->andReturn(collect([])); - CoursesOfAction::shouldRun()->once()->withArgs(fn ($api, $id) => 20 === $id)->andReturn(collect([])); + FullMemberAction::shouldRun()->once(); app(InitializeMembers::class)->handle($api); } @@ -36,14 +30,10 @@ class InitializeMembersTest extends TestCase public function testFetchesMembersViaCommandLine(): void { $this->loginNami(); - $api = app(NamiSettings::class)->login(); - app(SearchFake::class)->fetches(1, 0, [ MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]), ]); - app(MemberFake::class)->shows(100, 20); - MembershipsOfAction::shouldRun()->once()->withArgs(fn ($api, $id) => 20 === $id)->andReturn(collect([])); - CoursesOfAction::shouldRun()->once()->withArgs(fn ($api, $id) => 20 === $id)->andReturn(collect([])); + FullMemberAction::shouldRun()->once(); Artisan::call('member:pull'); }