2023-12-31 22:35:13 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Form;
|
|
|
|
|
|
|
|
use App\Form\Models\Form;
|
2024-01-01 16:53:32 +01:00
|
|
|
use App\Form\Models\Formtemplate;
|
2023-12-31 22:35:13 +01:00
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class FormIndexActionTest extends TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
public function testItDisplaysForms(): void
|
|
|
|
{
|
|
|
|
$this->login()->loginNami()->withoutExceptionHandling();
|
2024-01-01 16:53:32 +01:00
|
|
|
Formtemplate::factory()->name('tname')->sections([FormtemplateSectionRequest::new()->name('sname')->create()])->create();
|
|
|
|
Form::factory()
|
2024-01-01 16:43:40 +01:00
|
|
|
->name('lala')
|
|
|
|
->excerpt('fff')
|
|
|
|
->description('desc')
|
|
|
|
->from('2023-05-05')
|
|
|
|
->to('2023-06-07')
|
|
|
|
->mailTop('Guten Tag')
|
|
|
|
->mailBottom('Cheers')
|
|
|
|
->registrationFrom('2023-05-06 04:00:00')
|
|
|
|
->registrationUntil('2023-04-01 05:00:00')
|
|
|
|
->sections([FormtemplateSectionRequest::new()->name('sname')->fields([FormtemplateFieldRequest::new()])->create()])
|
|
|
|
->create();
|
2023-12-31 22:35:13 +01:00
|
|
|
|
|
|
|
$this->get(route('form.index'))
|
|
|
|
->assertOk()
|
2024-01-01 16:43:40 +01:00
|
|
|
->assertInertiaPath('data.data.0.config.sections.0.name', 'sname')
|
2023-12-31 22:35:13 +01:00
|
|
|
->assertInertiaPath('data.data.0.name', 'lala')
|
|
|
|
->assertInertiaPath('data.data.0.excerpt', 'fff')
|
|
|
|
->assertInertiaPath('data.data.0.description', 'desc')
|
|
|
|
->assertInertiaPath('data.data.0.mail_top', 'Guten Tag')
|
|
|
|
->assertInertiaPath('data.data.0.mail_bottom', 'Cheers')
|
2024-01-01 16:43:40 +01:00
|
|
|
->assertInertiaPath('data.data.0.from_human', '05.05.2023')
|
|
|
|
->assertInertiaPath('data.data.0.to_human', '07.06.2023')
|
|
|
|
->assertInertiaPath('data.data.0.from', '2023-05-05')
|
|
|
|
->assertInertiaPath('data.data.0.to', '2023-06-07')
|
2023-12-31 22:35:13 +01:00
|
|
|
->assertInertiaPath('data.data.0.registration_from', '2023-05-06 04:00:00')
|
2024-01-01 16:53:32 +01:00
|
|
|
->assertInertiaPath('data.data.0.registration_until', '2023-04-01 05:00:00')
|
|
|
|
->assertInertiaPath('data.meta.links.store', route('form.store'))
|
|
|
|
->assertInertiaPath('data.meta.templates.0.name', 'tname')
|
|
|
|
->assertInertiaPath('data.meta.templates.0.config.sections.0.name', 'sname');
|
2023-12-31 22:35:13 +01:00
|
|
|
}
|
|
|
|
}
|