Fix tests
This commit is contained in:
parent
04cfd95892
commit
311f1281f6
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Actions\PullMemberAction;
|
||||
use App\Setting\NamiSettings;
|
||||
use Illuminate\Console\Command;
|
||||
use Zoomyboy\LaravelNami\Member as NamiMember;
|
||||
|
||||
class MemberResyncCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'member:resync';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(NamiSettings $settings)
|
||||
{
|
||||
$api = $settings->login();
|
||||
|
||||
$api->search([])->each(
|
||||
fn (NamiMember $member) => app(PullMemberAction::class)->api($api)->member($member->group_id, $member->id)->execute()
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
Subproject commit e96d3dfe8eba1cbcb0eedc67ade07337170a7507
|
||||
Subproject commit d51b0ec3896ba1c20796df32d49da7578f584153
|
50
phpstan.neon
50
phpstan.neon
|
@ -1029,56 +1029,6 @@ parameters:
|
|||
count: 1
|
||||
path: packages/laravel-nami/tests/TestCase.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:overviewDataProvider\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:relationProvider\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:testGetAMemberFromOverviewWithNoRights\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:testGetASingleMember\\(\\) has parameter \\$check with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:testGetASingleMember\\(\\) has parameter \\$input with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:testGetAttributeOfMemberCollection\\(\\) has parameter \\$check with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:testGetAttributeOfMemberCollection\\(\\) has parameter \\$input with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:testGetAttributeOfMemberOverview\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PullMemberTest\\:\\:testSetRelations\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: packages/laravel-nami/tests/Unit/PullMemberTest.php
|
||||
|
||||
-
|
||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\Unit\\\\PushMemberTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
|
|
@ -6,6 +6,7 @@ use App\Actions\PullCoursesAction;
|
|||
use App\Actions\PullMemberAction;
|
||||
use App\Actions\PullMembershipsAction;
|
||||
use App\Initialize\InitializeMembers;
|
||||
use App\Member\Member;
|
||||
use App\Setting\NamiSettings;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
@ -19,13 +20,14 @@ 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]),
|
||||
]);
|
||||
PullMemberAction::shouldRun()->once()->with(100, 20);
|
||||
PullMembershipsAction::shouldRun()->once();
|
||||
PullCoursesAction::shouldRun()->once();
|
||||
PullMemberAction::shouldRun()->once()->with(100, 20)->andReturn($member);
|
||||
PullMembershipsAction::shouldRun()->once()->with($member);
|
||||
PullCoursesAction::shouldRun()->once()->with($member);
|
||||
|
||||
app(InitializeMembers::class)->handle($api);
|
||||
}
|
||||
|
|
|
@ -91,15 +91,4 @@ class PullMemberActionTest extends TestCase
|
|||
'region_id' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function testFetchesMembersWhenJoinedAtDateIsNull(): void
|
||||
{
|
||||
app(MemberFake::class)->shows(1000, 1001, [
|
||||
'eintrittsdatum' => null,
|
||||
]);
|
||||
|
||||
app(PullMemberAction::class)->handle(1000, 1001);
|
||||
|
||||
$this->assertDatabaseCount('members', 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue