From a25d983de0f01f5fc61815c1c604f2b23a2cd9d2 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Thu, 7 Mar 2024 21:24:12 +0100 Subject: [PATCH] Add efz for members --- app/Member/Member.php | 2 +- tests/Feature/Member/IndexTest.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Member/Member.php b/app/Member/Member.php index f51d0e40..842b25ae 100644 --- a/app/Member/Member.php +++ b/app/Member/Member.php @@ -156,7 +156,7 @@ class Member extends Model implements Geolocatable public function getEfzLink(): ?string { - return $this->isLeader() && $this->address && $this->zip && $this->location && $this->birthday + return $this->address && $this->zip && $this->location && $this->birthday ? route('efz', ['member' => $this]) : null; } diff --git a/tests/Feature/Member/IndexTest.php b/tests/Feature/Member/IndexTest.php index b2e6fba2..e0f32425 100644 --- a/tests/Feature/Member/IndexTest.php +++ b/tests/Feature/Member/IndexTest.php @@ -84,7 +84,7 @@ class IndexTest extends TestCase ->defaults() ->has(Membership::factory()->in('€ Mitglied', 456, 'Pfadfinder', 16)) ->create(['lastname' => 'B']); - Member::factory() + $emptyMember = Member::factory() ->defaults() ->create(['lastname' => 'C']); @@ -92,8 +92,7 @@ class IndexTest extends TestCase $response = $this->get('/member'); $this->assertInertiaHas(url("/member/{$member->id}/efz"), $response, 'data.data.0.efz_link'); - $this->assertInertiaHas(null, $response, 'data.data.1.efz_link'); - $this->assertInertiaHas(null, $response, 'data.data.2.efz_link'); + $this->assertInertiaHas(url("/member/{$emptyMember->id}/efz"), $response, 'data.data.2.efz_link'); $this->assertInertiaHas(true, $response, 'data.data.0.is_leader'); $this->assertInertiaHas(false, $response, 'data.data.1.is_leader'); $this->assertInertiaHas(false, $response, 'data.data.2.is_leader');