adrema/tests/Feature/Form/FormRequest.php

55 lines
1.6 KiB
PHP
Raw Normal View History

2023-12-27 22:54:58 +01:00
<?php
namespace Tests\Feature\Form;
use Worksome\RequestFactories\RequestFactory;
/**
* @method self name(string $name)
2024-01-10 21:31:34 +01:00
* @method self from(string $date)
* @method self to(string $date)
2023-12-31 21:02:40 +01:00
* @method self description(string $description)
2024-01-10 21:55:19 +01:00
* @method self mailTop(string $content)
* @method self mailBottom(string $content)
2023-12-31 21:02:40 +01:00
* @method self excerpt(string $description)
2024-01-10 21:31:34 +01:00
* @method self registrationFrom(string|null $date)
* @method self registrationUntil(string|null $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
}
}