Fix tests
continuous-integration/drone/push Build is failing Details

This commit is contained in:
philipp lang 2024-04-24 00:02:27 +02:00
parent 0ba8c58c76
commit 2984ad9372
2 changed files with 12 additions and 7 deletions

View File

@ -15,7 +15,6 @@ use Tests\RequestFactories\EditorRequestFactory;
* @method self from(string $from) * @method self from(string $from)
* @method self to(string $to) * @method self to(string $to)
* @method self excerpt(string $excerpt) * @method self excerpt(string $excerpt)
* @method self description(EditorRequestFactory $description)
* @method self registrationFrom(string|null $date) * @method self registrationFrom(string|null $date)
* @method self registrationUntil(string|null $date) * @method self registrationUntil(string|null $date)
*/ */
@ -84,4 +83,9 @@ class FormFactory extends Factory
{ {
return $this->state(['mail_bottom' => $factory->create()]); return $this->state(['mail_bottom' => $factory->create()]);
} }
public function description(EditorRequestFactory $factory): self
{
return $this->state(['description' => $factory->create()]);
}
} }

View File

@ -7,6 +7,7 @@ use App\Form\Models\Formtemplate;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use Carbon\Carbon; use Carbon\Carbon;
use Tests\Feature\Form\FormtemplateSectionRequest; use Tests\Feature\Form\FormtemplateSectionRequest;
use Tests\RequestFactories\EditorRequestFactory;
class FormIndexActionTest extends FormTestCase class FormIndexActionTest extends FormTestCase
{ {
@ -19,11 +20,11 @@ class FormIndexActionTest extends FormTestCase
$form = Form::factory() $form = Form::factory()
->name('lala') ->name('lala')
->excerpt('fff') ->excerpt('fff')
->description('desc') ->description(EditorRequestFactory::new()->text(10, 'desc'))
->from('2023-05-05') ->from('2023-05-05')
->to('2023-06-07') ->to('2023-06-07')
->mailTop('Guten Tag') ->mailTop(EditorRequestFactory::new()->text(10, 'Guten Tag'))
->mailBottom('Cheers') ->mailBottom(EditorRequestFactory::new()->text(10, 'Cheers'))
->registrationFrom('2023-05-06 04:00:00') ->registrationFrom('2023-05-06 04:00:00')
->registrationUntil('2023-04-01 05:00:00') ->registrationUntil('2023-04-01 05:00:00')
->sections([FormtemplateSectionRequest::new()->name('sname')->fields([$this->textField()])]) ->sections([FormtemplateSectionRequest::new()->name('sname')->fields([$this->textField()])])
@ -37,9 +38,9 @@ class FormIndexActionTest extends FormTestCase
->assertInertiaPath('data.data.0.config.sections.0.name', 'sname') ->assertInertiaPath('data.data.0.config.sections.0.name', 'sname')
->assertInertiaPath('data.data.0.id', $form->id) ->assertInertiaPath('data.data.0.id', $form->id)
->assertInertiaPath('data.data.0.excerpt', 'fff') ->assertInertiaPath('data.data.0.excerpt', 'fff')
->assertInertiaPath('data.data.0.description', 'desc') ->assertInertiaPath('data.data.0.description.blocks.0.data.text', 'desc')
->assertInertiaPath('data.data.0.mail_top', 'Guten Tag') ->assertInertiaPath('data.data.0.mail_top.blocks.0.data.text', 'Guten Tag')
->assertInertiaPath('data.data.0.mail_bottom', 'Cheers') ->assertInertiaPath('data.data.0.mail_bottom.blocks.0.data.text', 'Cheers')
->assertInertiaPath('data.data.0.from_human', '05.05.2023') ->assertInertiaPath('data.data.0.from_human', '05.05.2023')
->assertInertiaPath('data.data.0.to_human', '07.06.2023') ->assertInertiaPath('data.data.0.to_human', '07.06.2023')
->assertInertiaPath('data.data.0.from', '2023-05-05') ->assertInertiaPath('data.data.0.from', '2023-05-05')