laravel-nami-api/tests/Factories/MemberEntryRequestFactory.php

36 lines
943 B
PHP

<?php
namespace Zoomyboy\LaravelNami\Tests\Factories;
use Worksome\RequestFactories\RequestFactory;
use Zoomyboy\LaravelNami\Data\MemberEntry;
class MemberEntryRequestFactory extends RequestFactory
{
public function definition(): array
{
return [
'firstname' => $this->faker->firstName(),
'lastname' => $this->faker->lastName(),
'groupId' => $this->faker->numberBetween(100, 200),
'id' => $this->faker->numberBetween(100, 200),
'agegroup' => $this->faker->randomElement(['Wölfling', 'Juffi', 'Pfadi', 'Rover']),
];
}
public function noFirstname(): self
{
return $this->state([
'firstname' => null,
]);
}
/**
* @param array<string, mixed> $attributes
*/
public function toMember(array $attributes = []): MemberEntry
{
return MemberEntry::from($this->create($attributes));
}
}