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');