2023-12-27 22:54:58 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Form;
|
|
|
|
|
|
|
|
use Worksome\RequestFactories\RequestFactory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @method self name(string $name)
|
2023-12-31 21:02:40 +01:00
|
|
|
* @method self description(string $description)
|
|
|
|
* @method self excerpt(string $description)
|
2024-01-10 21:13:17 +01:00
|
|
|
* @method self registrationFrom(string $date)
|
|
|
|
* @method self registrationUntil(string $date)
|
2023-12-27 22:54:58 +01:00
|
|
|
*/
|
|
|
|
class FormRequest extends RequestFactory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function definition(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'name' => $this->faker->words(4, true),
|
|
|
|
'description' => $this->faker->text(),
|
2023-12-31 21:02:40 +01:00
|
|
|
'excerpt' => $this->faker->words(10, true),
|
2023-12-27 22:54:58 +01:00
|
|
|
'config' => ['sections' => []],
|
2023-12-31 21:46:52 +01:00
|
|
|
'from' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
|
|
|
|
'to' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
|
|
|
|
'registration_from' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
|
|
|
|
'registration_until' => $this->faker->dateTime()->format('Y-m-d H:i:s'),
|
|
|
|
'mail_top' => $this->faker->text(),
|
|
|
|
'mail_bottom' => $this->faker->text(),
|
2023-12-27 22:54:58 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array<int, FormtemplateSectionRequest> $sections
|
|
|
|
*/
|
|
|
|
public function sections(array $sections): self
|
|
|
|
{
|
|
|
|
return $this->state(['config.sections' => $sections]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param mixed $args
|
|
|
|
*/
|
|
|
|
public function __call(string $method, $args): self
|
|
|
|
{
|
2023-12-31 21:46:52 +01:00
|
|
|
return $this->state([str($method)->snake()->toString() => $args[0]]);
|
2023-12-27 22:54:58 +01:00
|
|
|
}
|
|
|
|
}
|