Fixed: Joined at date can be null

This commit is contained in:
philipp lang 2023-02-07 22:48:33 +01:00
parent 2975b77da0
commit 04cfd95892
3 changed files with 14 additions and 3 deletions

View File

@ -19,7 +19,7 @@ class PullMemberAction
{ {
use AsAction; use AsAction;
public function handle(int $groupId, int $memberId): Member public function handle(int $groupId, int $memberId): ?Member
{ {
$member = $this->api()->member($groupId, $memberId); $member = $this->api()->member($groupId, $memberId);
@ -28,7 +28,7 @@ class PullMemberAction
return Member::updateOrCreate(['nami_id' => $member->id], [ return Member::updateOrCreate(['nami_id' => $member->id], [
'firstname' => $member->firstname, 'firstname' => $member->firstname,
'lastname' => $member->lastname, 'lastname' => $member->lastname,
'joined_at' => $member->joinedAt, 'joined_at' => $member->joinedAt ?: now(),
'birthday' => $member->birthday, 'birthday' => $member->birthday,
'send_newspaper' => $member->sendNewspaper, 'send_newspaper' => $member->sendNewspaper,
'address' => $member->address, 'address' => $member->address,

@ -1 +1 @@
Subproject commit fca340c520916db554b6bfa4562dd14ef97d1b35 Subproject commit e96d3dfe8eba1cbcb0eedc67ade07337170a7507

View File

@ -91,4 +91,15 @@ class PullMemberActionTest extends TestCase
'region_id' => null, '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);
}
} }