From 700d69d1a2d2cd96684717d0b1292b28bdaf9ce7 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Wed, 12 Jun 2024 00:04:13 +0200 Subject: [PATCH] Add male and female for member factory --- database/factories/GenderFactory.php | 10 ++++++++++ tests/Feature/Contribution/StoreTest.php | 8 ++++---- tests/Feature/Member/ShowTest.php | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/database/factories/GenderFactory.php b/database/factories/GenderFactory.php index ff269acf..1376a413 100644 --- a/database/factories/GenderFactory.php +++ b/database/factories/GenderFactory.php @@ -28,6 +28,16 @@ class GenderFactory extends Factory return $this->state(['name' => $name]); } + public function male(): self + { + return $this->name('Männlich'); + } + + public function female(): self + { + return $this->name('Weiblich'); + } + public function inNami(int $namiId): self { return $this->state(['nami_id' => $namiId]); diff --git a/tests/Feature/Contribution/StoreTest.php b/tests/Feature/Contribution/StoreTest.php index c3a3286f..af2b7cdc 100644 --- a/tests/Feature/Contribution/StoreTest.php +++ b/tests/Feature/Contribution/StoreTest.php @@ -36,8 +36,8 @@ class StoreTest extends TestCase $this->withoutExceptionHandling(); Tex::spy(); $this->login()->loginNami(); - $member1 = Member::factory()->defaults()->for(Gender::factory())->create(['address' => 'Maxstr 44', 'zip' => '42719', 'firstname' => 'Max', 'lastname' => 'Muster']); - $member2 = Member::factory()->defaults()->for(Gender::factory())->create(['address' => 'Maxstr 44', 'zip' => '42719', 'firstname' => 'Jane', 'lastname' => 'Muster']); + $member1 = Member::factory()->defaults()->create(['address' => 'Maxstr 44', 'zip' => '42719', 'firstname' => 'Max', 'lastname' => 'Muster']); + $member2 = Member::factory()->defaults()->create(['address' => 'Maxstr 44', 'zip' => '42719', 'firstname' => 'Jane', 'lastname' => 'Muster']); $response = $this->call('GET', '/contribution-generate', [ 'payload' => ContributionRequestFactory::new()->type($type)->state([ @@ -72,8 +72,8 @@ class StoreTest extends TestCase { $this->withoutExceptionHandling(); Tex::spy(); - Gender::factory()->create(['name' => 'Weiblich']); - Gender::factory()->create(['name' => 'Männlich']); + Gender::factory()->female()->create(); + Gender::factory()->male()->create(); Passport::actingAsClient(Client::factory()->create(), ['contribution-generate']); $country = Country::factory()->create(); Member::factory()->defaults()->create(['address' => 'Maxstr 44', 'zip' => '42719', 'firstname' => 'Max', 'lastname' => 'Muster']); diff --git a/tests/Feature/Member/ShowTest.php b/tests/Feature/Member/ShowTest.php index 07799ac1..682ac205 100644 --- a/tests/Feature/Member/ShowTest.php +++ b/tests/Feature/Member/ShowTest.php @@ -35,7 +35,7 @@ class ShowTest extends TestCase ->for(Group::factory()->name('Stamm Beispiel')) ->has(Membership::factory()->promise(now())->in('€ LeiterIn', 5, 'Jungpfadfinder', 88)->from('2022-11-19')) ->has(InvoicePosition::factory()->for(Invoice::factory())->price(1050)->description('uu')) - ->for(Gender::factory()->name('Männlich')) + ->for(Gender::factory()->male()) ->for(Region::factory()->name('NRW')) ->postBillKind() ->inNami(123)