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)
|
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' => []],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
{
|
|
|
|
return $this->state([$method => $args[0]]);
|
|
|
|
}
|
|
|
|
}
|