feat(form-builder): FormSubmission cast + factory state for failure_response_code
Per RFC-WS-6 §Q3 v1.3 addition 2. - Added 'failure_response_code' to FormSubmission $fillable + 'string' cast. Plain string (not enum) — the exception subclass on form_submission_action_failures is the canonical classification source; this column is a denormalised mirror for response-shape rendering. - Factory fluent state method withFailureResponseCode() with documentation of the four valid values. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -64,4 +64,23 @@ final class FormSubmissionFactory extends Factory
|
||||
'organisation_id' => $event->organisation_id,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set failure_response_code. Typically used in tests asserting the
|
||||
* downstream rendering behaviour for failed submissions.
|
||||
*
|
||||
* Valid values per RFC-WS-6 §Q3 v1.3 addition 2:
|
||||
* - 'schema_config_error'
|
||||
* - 'temporary_error'
|
||||
* - 'data_integrity_error'
|
||||
* - 'unknown_error'
|
||||
*
|
||||
* Note: writing this value via factory does NOT itself set apply_status
|
||||
* to FAILED. Pair with an explicit apply_status attribute in tests
|
||||
* that need a coherent failed-submission fixture.
|
||||
*/
|
||||
public function withFailureResponseCode(string $code): static
|
||||
{
|
||||
return $this->state(fn () => ['failure_response_code' => $code]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user