refactor(form-builder): strict validator on save; strip rules.unique fallback
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Tests\Feature\Api\V1\Public\FormBuilder;
|
||||
|
||||
use App\Enums\FormBuilder\FormFieldType;
|
||||
use App\Enums\FormBuilder\FormFieldValidationRuleType;
|
||||
use App\Enums\FormBuilder\FormPurpose;
|
||||
use App\Models\FormBuilder\FormField;
|
||||
use App\Models\FormBuilder\FormSchema;
|
||||
@@ -43,15 +44,17 @@ final class PublicFormValidationTest extends TestCase
|
||||
'is_required' => true,
|
||||
'is_portal_visible' => true,
|
||||
]);
|
||||
FormField::factory()->create([
|
||||
'form_schema_id' => $this->schema->id,
|
||||
'field_type' => FormFieldType::NUMBER->value,
|
||||
'slug' => 'leeftijd',
|
||||
'label' => 'Leeftijd',
|
||||
'is_required' => false,
|
||||
'is_portal_visible' => true,
|
||||
'validation_rules' => ['min' => 16, 'max' => 99],
|
||||
]);
|
||||
FormField::factory()
|
||||
->withValidationRule(FormFieldValidationRuleType::MinValue, ['value' => 16])
|
||||
->withValidationRule(FormFieldValidationRuleType::MaxValue, ['value' => 99])
|
||||
->create([
|
||||
'form_schema_id' => $this->schema->id,
|
||||
'field_type' => FormFieldType::NUMBER->value,
|
||||
'slug' => 'leeftijd',
|
||||
'label' => 'Leeftijd',
|
||||
'is_required' => false,
|
||||
'is_portal_visible' => true,
|
||||
]);
|
||||
FormField::factory()->create([
|
||||
'form_schema_id' => $this->schema->id,
|
||||
'field_type' => FormFieldType::SELECT->value,
|
||||
|
||||
Reference in New Issue
Block a user