From a5f1c900036db9892dad4365de77c6b872151d11 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sun, 22 Sep 2024 12:28:10 +0200 Subject: [PATCH] Fix tests --- app/Fileshare/Actions/ListFilesAction.php | 2 +- packages/laravel-nami | 2 +- tests/Feature/Initialize/InitializeMembersTest.php | 4 ++-- tests/Feature/Initializer/SearchTest.php | 10 +++++----- tests/Feature/Member/PullCoursesActionTest.php | 5 ++--- tests/Feature/Remote/RemoteSearchTest.php | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/Fileshare/Actions/ListFilesAction.php b/app/Fileshare/Actions/ListFilesAction.php index 96f2f0a0..e9fddcdd 100644 --- a/app/Fileshare/Actions/ListFilesAction.php +++ b/app/Fileshare/Actions/ListFilesAction.php @@ -17,6 +17,6 @@ class ListFilesAction */ public function handle(ActionRequest $request, Fileshare $fileshare): DataCollection { - return ResourceData::collect($fileshare->type->getSubDirectories($request->input('parent')))->wrap('data'); + return ResourceData::collect($fileshare->type->getSubDirectories($request->input('parent')), DataCollection::class)->wrap('data'); } } diff --git a/packages/laravel-nami b/packages/laravel-nami index 7c876d75..3f5321af 160000 --- a/packages/laravel-nami +++ b/packages/laravel-nami @@ -1 +1 @@ -Subproject commit 7c876d75c9b6ec9fd36511b743beae0d40532878 +Subproject commit 3f5321af9d6d48e1e50d6041548abfb74e594de0 diff --git a/tests/Feature/Initialize/InitializeMembersTest.php b/tests/Feature/Initialize/InitializeMembersTest.php index 699844eb..ed18f3e6 100644 --- a/tests/Feature/Initialize/InitializeMembersTest.php +++ b/tests/Feature/Initialize/InitializeMembersTest.php @@ -20,7 +20,7 @@ class InitializeMembersTest extends TestCase $this->loginNami(); $api = app(NamiSettings::class)->login(); app(SearchFake::class)->fetches(1, 0, 100, [ - MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]), + MemberEntry::toFactory()->toMember(['groupId' => 100, 'id' => 20]), ]); FullMemberAction::partialMock()->shouldReceive('configureJob')->once(); FullMemberAction::partialMock()->shouldReceive('handle')->once(); @@ -32,7 +32,7 @@ class InitializeMembersTest extends TestCase { $this->loginNami(); app(SearchFake::class)->fetches(1, 0, 100, [ - MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]), + MemberEntry::toFactory()->toMember(['groupId' => 100, 'id' => 20]), ]); FullMemberAction::partialMock()->shouldReceive('configureJob')->once(); FullMemberAction::partialMock()->shouldReceive('handle')->once(); diff --git a/tests/Feature/Initializer/SearchTest.php b/tests/Feature/Initializer/SearchTest.php index b590745e..90c96f66 100644 --- a/tests/Feature/Initializer/SearchTest.php +++ b/tests/Feature/Initializer/SearchTest.php @@ -23,8 +23,8 @@ class SearchTest extends TestCase { $this->withoutExceptionHandling(); app(SearchFake::class)->fetches(1, 0, 10, [ - MemberEntry::factory()->state(['id' => 2, 'groupId' => 100, 'firstname' => 'Max', 'lastname' => 'Muster', 'birthday' => '2013-07-04 00:00:00'])->toMember(), - MemberEntry::factory()->state(['id' => 2, 'groupId' => 150, 'firstname' => 'Jane', 'lastname' => 'Muster', 'birthday' => '2013-07-04 00:00:00'])->toMember(), + MemberEntry::toFactory()->state(['id' => 2, 'groupId' => 100, 'firstname' => 'Max', 'lastname' => 'Muster', 'birthday' => '2013-07-04 00:00:00'])->toMember(), + MemberEntry::toFactory()->state(['id' => 2, 'groupId' => 150, 'firstname' => 'Jane', 'lastname' => 'Muster', 'birthday' => '2013-07-04 00:00:00'])->toMember(), ]); Auth::success(333, 'secret'); @@ -53,7 +53,7 @@ class SearchTest extends TestCase { $this->withoutExceptionHandling(); app(SearchFake::class)->fetches(1, 0, 10, [ - MemberEntry::factory()->noFirstname()->toMember(), + MemberEntry::toFactory()->noFirstname()->toMember(), ]); Auth::success(333, 'secret'); @@ -70,8 +70,8 @@ class SearchTest extends TestCase { $this->withoutExceptionHandling(); app(SearchFake::class)->fetches(2, 10, 10, [ - MemberEntry::factory()->toMember(), - MemberEntry::factory()->toMember(), + MemberEntry::toFactory()->toMember(), + MemberEntry::toFactory()->toMember(), ]); Auth::success(333, 'secret'); diff --git a/tests/Feature/Member/PullCoursesActionTest.php b/tests/Feature/Member/PullCoursesActionTest.php index 09965b8f..2531bb1e 100644 --- a/tests/Feature/Member/PullCoursesActionTest.php +++ b/tests/Feature/Member/PullCoursesActionTest.php @@ -7,7 +7,6 @@ use App\Activity; use App\Country; use App\Course\Models\Course; use App\Course\Models\CourseMember; -use App\Fee; use App\Gender; use App\Group; use App\Member\Member; @@ -48,7 +47,7 @@ class PullCoursesActionTest extends TestCase $activity = Activity::factory()->inNami(1003)->name('Tätigkeit')->create(); $member = Member::factory()->defaults()->for(Group::factory()->inNami(1000)->name('SG Wald'))->inNami(1001)->create(); $course = Course::factory()->name('BS')->inNami(11)->create(); - app(CourseFake::class)->fetches(1001, [50])->shows(1001, NamiCourse::factory()->toCourse([ + app(CourseFake::class)->fetches(1001, [50])->shows(1001, NamiCourse::toFactory()->toCourse([ 'courseId' => 11, 'organizer' => 'TTT', 'eventName' => 'Schulung', @@ -93,7 +92,7 @@ class PullCoursesActionTest extends TestCase ->has(CourseMember::factory()->for(Course::factory()->inNami(50))->inNami(55), 'courses') ->inNami(1001) ->create(); - app(CourseFake::class)->fetches(1001, [55])->shows(1001, NamiCourse::factory()->toCourse(['id' => 55, 'courseId' => 50, 'organizer' => 'ZZU'])); + app(CourseFake::class)->fetches(1001, [55])->shows(1001, NamiCourse::toFactory()->toCourse(['id' => 55, 'courseId' => 50, 'organizer' => 'ZZU'])); app(PullCoursesAction::class)->handle($member); diff --git a/tests/Feature/Remote/RemoteSearchTest.php b/tests/Feature/Remote/RemoteSearchTest.php index 01fb87e5..71eb9af9 100644 --- a/tests/Feature/Remote/RemoteSearchTest.php +++ b/tests/Feature/Remote/RemoteSearchTest.php @@ -30,7 +30,7 @@ class RemoteSearchTest extends TestCase { Auth::success(90100, 'secret'); app(SearchFake::class)->fetches(1, 0, 50, [ - MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20, 'memberId' => 56, 'firstname' => 'Max', 'lastname' => 'Muster']), + MemberEntry::toFactory()->toMember(['groupId' => 100, 'id' => 20, 'memberId' => 56, 'firstname' => 'Max', 'lastname' => 'Muster']), ]); $accessToken = $this->loginRemotely()->json('access_token');