Add zip and location to default model
This commit is contained in:
parent
94efb99ea4
commit
c025e5e454
|
@ -53,6 +53,8 @@ class FormResource extends JsonResource
|
||||||
'needs_prevention' => $this->needs_prevention,
|
'needs_prevention' => $this->needs_prevention,
|
||||||
'prevention_text' => $this->prevention_text,
|
'prevention_text' => $this->prevention_text,
|
||||||
'prevention_conditions' => $this->prevention_conditions,
|
'prevention_conditions' => $this->prevention_conditions,
|
||||||
|
'zip' => $this->zip,
|
||||||
|
'location' => $this->location,
|
||||||
'links' => [
|
'links' => [
|
||||||
'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]),
|
'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]),
|
||||||
'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]),
|
'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]),
|
||||||
|
@ -102,6 +104,8 @@ class FormResource extends JsonResource
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'export' => ExportData::from([]),
|
'export' => ExportData::from([]),
|
||||||
'prevention_conditions' => ['mode' => 'all', 'ifs' => []],
|
'prevention_conditions' => ['mode' => 'all', 'ifs' => []],
|
||||||
|
'zip' => '',
|
||||||
|
'location' => '',
|
||||||
],
|
],
|
||||||
'section_default' => [
|
'section_default' => [
|
||||||
'name' => '',
|
'name' => '',
|
||||||
|
|
|
@ -57,6 +57,8 @@ class FormFactory extends Factory
|
||||||
'is_private' => false,
|
'is_private' => false,
|
||||||
'export' => ExportData::from([]),
|
'export' => ExportData::from([]),
|
||||||
'prevention_conditions' => Condition::defaults(),
|
'prevention_conditions' => Condition::defaults(),
|
||||||
|
'zip' => $this->faker->numberBetween(1100, 99999),
|
||||||
|
'location' => $this->faker->city(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ class FormIndexActionTest extends FormTestCase
|
||||||
->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()])])
|
||||||
->has(Participant::factory()->count(5))
|
->has(Participant::factory()->count(5))
|
||||||
|
->zip('12345')
|
||||||
|
->location('SG')
|
||||||
->create();
|
->create();
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
@ -46,6 +48,8 @@ class FormIndexActionTest extends FormTestCase
|
||||||
->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')
|
||||||
|
->assertInertiaPath('data.data.0.zip', '12345')
|
||||||
|
->assertInertiaPath('data.data.0.location', 'SG')
|
||||||
->assertInertiaPath('data.data.0.participants_count', 5)
|
->assertInertiaPath('data.data.0.participants_count', 5)
|
||||||
->assertInertiaPath('data.data.0.to', '2023-06-07')
|
->assertInertiaPath('data.data.0.to', '2023-06-07')
|
||||||
->assertInertiaPath('data.data.0.is_active', true)
|
->assertInertiaPath('data.data.0.is_active', true)
|
||||||
|
@ -70,7 +74,9 @@ class FormIndexActionTest extends FormTestCase
|
||||||
->assertInertiaPath('data.meta.base_url', url(''))
|
->assertInertiaPath('data.meta.base_url', url(''))
|
||||||
->assertInertiaPath('data.meta.namiTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
|
->assertInertiaPath('data.meta.namiTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
|
||||||
->assertInertiaPath('data.meta.specialTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
|
->assertInertiaPath('data.meta.specialTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
|
||||||
->assertInertiaPath('data.meta.section_default.name', '');
|
->assertInertiaPath('data.meta.section_default.name', '')
|
||||||
|
->assertInertiaPath('data.meta.default.zip', '')
|
||||||
|
->assertInertiaPath('data.meta.default.location', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFormtemplatesHaveData(): void
|
public function testFormtemplatesHaveData(): void
|
||||||
|
|
Loading…
Reference in New Issue