Refactor FormSubmissionDataFactory to use TestHelpers trait
- Move FormSubmissionDataFactory methods into TestHelpers trait - Update import statements across multiple test files - Remove standalone FormSubmissionDataFactory class - Simplify form submission data generation in tests - Add documentation for new generateFormSubmissionData method
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Tests\Helpers\FormSubmissionDataFactory;
|
||||
|
||||
|
||||
it('can submit form with dyanamic select option', function () {
|
||||
$user = $this->actingAsUser();
|
||||
@@ -11,14 +11,14 @@ it('can submit form with dyanamic select option', function () {
|
||||
$form->properties = collect($form->properties)->map(function ($property) use (&$selectionsPreData) {
|
||||
if (in_array($property['type'], ['select', 'multi_select'])) {
|
||||
$property['allow_creation'] = true;
|
||||
$selectionsPreData[$property['id']] = ($property['type'] == 'select') ? 'New single select - '.time() : ['New multi select - '.time()];
|
||||
$selectionsPreData[$property['id']] = ($property['type'] == 'select') ? 'New single select - ' . time() : ['New multi select - ' . time()];
|
||||
}
|
||||
|
||||
return $property;
|
||||
})->toArray();
|
||||
$form->update();
|
||||
|
||||
$formData = FormSubmissionDataFactory::generateSubmissionData($form, $selectionsPreData);
|
||||
$formData = $this->generateFormSubmissionData($form, $selectionsPreData);
|
||||
$this->postJson(route('forms.answer', $form->slug), $formData)
|
||||
->assertSuccessful()
|
||||
->assertJson([
|
||||
|
||||
Reference in New Issue
Block a user