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

36 lines
943 B
PHP
Raw Normal View History

2023-02-07 02:30:00 +01:00
<?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),
2023-05-07 21:54:00 +02:00
'agegroup' => $this->faker->randomElement(['Wölfling', 'Juffi', 'Pfadi', 'Rover']),
2023-02-07 02:30:00 +01:00
];
}
2023-05-07 21:54:00 +02:00
public function noFirstname(): self
{
return $this->state([
'firstname' => null,
]);
}
2023-02-07 02:30:00 +01:00
/**
* @param array<string, mixed> $attributes
*/
public function toMember(array $attributes = []): MemberEntry
{
return MemberEntry::from($this->create($attributes));
}
}