Add from date for memberships
continuous-integration/drone/push Build is failing Details

This commit is contained in:
philipp lang 2023-02-27 22:00:27 +01:00
parent 4512a41344
commit 222bca62ee
3 changed files with 7 additions and 3 deletions

View File

@ -25,7 +25,7 @@ class MembershipResource extends JsonResource
'activity_name' => $this->activity->name,
'subactivity_id' => $this->subactivity_id,
'subactivity_name' => $this->subactivity?->name,
'human_date' => $this->created_at->format('d.m.Y'),
'human_date' => $this->from->format('d.m.Y'),
'promised_at' => $this->promised_at?->format('Y-m-d'),
];
}

View File

@ -40,6 +40,11 @@ class MembershipFactory extends Factory
return $this->state(['nami_id' => null]);
}
public function from(string $from): self
{
return $this->state(['from' => Carbon::parse($from)]);
}
public function inLocal(string $activity, ?string $subactivity = null): self
{
$instance = $this->for(Activity::factory()->name($activity));

View File

@ -89,12 +89,11 @@ class IndexTest extends TestCase
public function testItShowsActivityAndSubactivityNamesOfMember(): void
{
Carbon::setTestNow(Carbon::parse('2022-11-02 03:00:00'));
$this->withoutExceptionHandling()->login()->loginNami();
$group = Group::factory()->create();
$member = Member::factory()
->defaults()
->has(Membership::factory()->for($group)->in('€ Mitglied', 122, 'Wölfling', 234))
->has(Membership::factory()->for($group)->in('€ Mitglied', 122, 'Wölfling', 234)->from('2022-11-02'))
->create();
$response = $this->get('/member');