Add efz for members
This commit is contained in:
parent
b80b7ea600
commit
a25d983de0
|
@ -156,7 +156,7 @@ class Member extends Model implements Geolocatable
|
||||||
|
|
||||||
public function getEfzLink(): ?string
|
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])
|
? route('efz', ['member' => $this])
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ class IndexTest extends TestCase
|
||||||
->defaults()
|
->defaults()
|
||||||
->has(Membership::factory()->in('€ Mitglied', 456, 'Pfadfinder', 16))
|
->has(Membership::factory()->in('€ Mitglied', 456, 'Pfadfinder', 16))
|
||||||
->create(['lastname' => 'B']);
|
->create(['lastname' => 'B']);
|
||||||
Member::factory()
|
$emptyMember = Member::factory()
|
||||||
->defaults()
|
->defaults()
|
||||||
->create(['lastname' => 'C']);
|
->create(['lastname' => 'C']);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ class IndexTest extends TestCase
|
||||||
$response = $this->get('/member');
|
$response = $this->get('/member');
|
||||||
|
|
||||||
$this->assertInertiaHas(url("/member/{$member->id}/efz"), $response, 'data.data.0.efz_link');
|
$this->assertInertiaHas(url("/member/{$member->id}/efz"), $response, 'data.data.0.efz_link');
|
||||||
$this->assertInertiaHas(null, $response, 'data.data.1.efz_link');
|
$this->assertInertiaHas(url("/member/{$emptyMember->id}/efz"), $response, 'data.data.2.efz_link');
|
||||||
$this->assertInertiaHas(null, $response, 'data.data.2.efz_link');
|
|
||||||
$this->assertInertiaHas(true, $response, 'data.data.0.is_leader');
|
$this->assertInertiaHas(true, $response, 'data.data.0.is_leader');
|
||||||
$this->assertInertiaHas(false, $response, 'data.data.1.is_leader');
|
$this->assertInertiaHas(false, $response, 'data.data.1.is_leader');
|
||||||
$this->assertInertiaHas(false, $response, 'data.data.2.is_leader');
|
$this->assertInertiaHas(false, $response, 'data.data.2.is_leader');
|
||||||
|
|
Loading…
Reference in New Issue