feat(forms): add PHP enums for form builder

9 backed string enums covering purpose, field type, submission status/mode/review,
field width, value storage hint, snapshot mode, webhook delivery status.
FormPurpose/FormFieldType include helper methods per ARCH §3/§5. All with
declare(strict_types=1) and values() helpers for validation rules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-17 11:27:01 +02:00
parent 032ad9d953
commit 135bdb352c
18 changed files with 731 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
enum FormFieldDisplayWidth: string
{
case HALF = 'half';
case FULL = 'full';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
}

View File

@@ -0,0 +1,98 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
/**
* Built-in form field types per ARCH §5.1.
*
* Note: `form_fields.field_type` is stored as string (not DB enum) to allow
* runtime-registered custom types via CustomFieldTypeRegistry (§17.2).
*/
enum FormFieldType: string
{
case TEXT = 'TEXT';
case TEXTAREA = 'TEXTAREA';
case EMAIL = 'EMAIL';
case PHONE = 'PHONE';
case NUMBER = 'NUMBER';
case DATE = 'DATE';
case DATETIME = 'DATETIME';
case BOOLEAN = 'BOOLEAN';
case RADIO = 'RADIO';
case SELECT = 'SELECT';
case MULTISELECT = 'MULTISELECT';
case CHECKBOX_LIST = 'CHECKBOX_LIST';
case FILE_UPLOAD = 'FILE_UPLOAD';
case IMAGE_UPLOAD = 'IMAGE_UPLOAD';
case SIGNATURE = 'SIGNATURE';
case TAG_PICKER = 'TAG_PICKER';
case HEADING = 'HEADING';
case PARAGRAPH = 'PARAGRAPH';
case URL = 'URL';
case SECTION_PRIORITY = 'SECTION_PRIORITY';
case AVAILABILITY_PICKER = 'AVAILABILITY_PICKER';
case TABLE_ROWS = 'TABLE_ROWS';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
/**
* Recommended storage hint per ARCH §5.2. Suggestive, organiser may override.
*/
public function recommendedValueStorageHint(): FormValueStorageHint
{
return match ($this) {
self::TEXT,
self::TEXTAREA,
self::EMAIL,
self::PHONE,
self::URL,
self::RADIO,
self::SELECT => FormValueStorageHint::STRING,
self::NUMBER => FormValueStorageHint::NUMBER,
self::DATE,
self::DATETIME => FormValueStorageHint::DATE,
self::BOOLEAN => FormValueStorageHint::BOOL,
default => FormValueStorageHint::JSON,
};
}
/**
* Per ARCH §7.1. Presentational types and complex payloads are not filterable.
*/
public function isFilterable(): bool
{
return match ($this) {
self::TEXTAREA,
self::FILE_UPLOAD,
self::IMAGE_UPLOAD,
self::SIGNATURE,
self::HEADING,
self::PARAGRAPH,
self::TABLE_ROWS,
self::SECTION_PRIORITY,
self::AVAILABILITY_PICKER => false,
default => true,
};
}
/**
* HEADING and PARAGRAPH are presentational only no stored value.
*/
public function hasValue(): bool
{
return match ($this) {
self::HEADING, self::PARAGRAPH => false,
default => true,
};
}
}

View File

@@ -0,0 +1,119 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
enum FormPurpose: string
{
case EVENT_REGISTRATION = 'event_registration';
case USER_PROFILE = 'user_profile';
case ARTIST_PROFILE = 'artist_profile';
case COMPANY_PROFILE = 'company_profile';
case ARTIST_ADVANCE = 'artist_advance';
case SUPPLIER_INTAKE = 'supplier_intake';
case INCIDENT_REPORT = 'incident_report';
case FEEDBACK = 'feedback';
case POST_EVENT_EVALUATION = 'post_event_evaluation';
case SIGNATURE_CONTRACT = 'signature_contract';
case SIGNATURE_CODE_OF_CONDUCT = 'signature_code_of_conduct';
case SIGNATURE_RECEIPT = 'signature_receipt';
case ABSENCE_REPORT = 'absence_report';
case CHECK_OUT_INVENTORY = 'check_out_inventory';
case PUBLIC_COMPLAINT = 'public_complaint';
case PUBLIC_PRESS_REQUEST = 'public_press_request';
case PUBLIC_RSVP = 'public_rsvp';
case ONBOARDING_WIZARD = 'onboarding_wizard';
case EVENT_SETUP_WIZARD = 'event_setup_wizard';
case COMPANY_CUSTOM = 'company_custom';
case ARTIST_CUSTOM = 'artist_custom';
case CUSTOM = 'custom';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
/**
* Default subject_type for each purpose per ARCH §3.1.
* null = subject may be null (public or ambiguous).
*/
public function defaultSubjectType(): ?string
{
return match ($this) {
self::EVENT_REGISTRATION,
self::POST_EVENT_EVALUATION,
self::SIGNATURE_RECEIPT,
self::ABSENCE_REPORT,
self::CHECK_OUT_INVENTORY => 'person',
self::USER_PROFILE,
self::SIGNATURE_CODE_OF_CONDUCT => 'user',
self::ARTIST_PROFILE,
self::ARTIST_ADVANCE,
self::ARTIST_CUSTOM => 'artist',
self::COMPANY_PROFILE,
self::SUPPLIER_INTAKE,
self::COMPANY_CUSTOM => 'company',
self::ONBOARDING_WIZARD => 'organisation',
self::EVENT_SETUP_WIZARD => 'event',
self::INCIDENT_REPORT,
self::FEEDBACK,
self::SIGNATURE_CONTRACT => 'user',
self::PUBLIC_COMPLAINT,
self::PUBLIC_PRESS_REQUEST,
self::PUBLIC_RSVP,
self::CUSTOM => null,
};
}
public function defaultSubmissionMode(): FormSubmissionMode
{
return match ($this) {
self::EVENT_REGISTRATION,
self::ARTIST_ADVANCE,
self::SUPPLIER_INTAKE => FormSubmissionMode::DRAFT_SINGLE,
self::INCIDENT_REPORT,
self::FEEDBACK,
self::SIGNATURE_RECEIPT,
self::ABSENCE_REPORT,
self::CHECK_OUT_INVENTORY,
self::PUBLIC_COMPLAINT,
self::PUBLIC_PRESS_REQUEST => FormSubmissionMode::MULTIPLE,
self::USER_PROFILE,
self::ARTIST_PROFILE,
self::COMPANY_PROFILE,
self::POST_EVENT_EVALUATION,
self::SIGNATURE_CONTRACT,
self::SIGNATURE_CODE_OF_CONDUCT,
self::PUBLIC_RSVP,
self::ONBOARDING_WIZARD,
self::EVENT_SETUP_WIZARD,
self::COMPANY_CUSTOM,
self::ARTIST_CUSTOM,
self::CUSTOM => FormSubmissionMode::SINGLE,
};
}
public function allowsPublicAccess(): bool
{
return match ($this) {
self::PUBLIC_COMPLAINT,
self::PUBLIC_PRESS_REQUEST,
self::PUBLIC_RSVP,
self::ARTIST_ADVANCE,
self::SUPPLIER_INTAKE => true,
default => false,
};
}
}

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
enum FormSchemaSnapshotMode: string
{
case NEVER = 'never';
case ON_SUBMIT = 'on_submit';
case ALWAYS = 'always';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
}

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
enum FormSubmissionMode: string
{
case SINGLE = 'single';
case MULTIPLE = 'multiple';
case DRAFT_SINGLE = 'draft_single';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
}

View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
enum FormSubmissionReviewStatus: string
{
case PENDING_REVIEW = 'pending_review';
case APPROVED = 'approved';
case REJECTED = 'rejected';
case CHANGES_REQUESTED = 'changes_requested';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
}

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
enum FormSubmissionStatus: string
{
case DRAFT = 'draft';
case SUBMITTED = 'submitted';
case ARCHIVED = 'archived';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
enum FormValueStorageHint: string
{
case JSON = 'json';
case STRING = 'string';
case NUMBER = 'number';
case DATE = 'date';
case BOOL = 'bool';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
}

View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace App\Enums\FormBuilder;
enum FormWebhookDeliveryStatus: string
{
case PENDING = 'pending';
case DELIVERED = 'delivered';
case FAILED = 'failed';
case DEAD_LETTER = 'dead_letter';
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(fn (self $case): string => $case->value, self::cases());
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormFieldDisplayWidth;
use PHPUnit\Framework\TestCase;
class FormFieldDisplayWidthTest extends TestCase
{
public function test_has_half_and_full_cases(): void
{
$this->assertSame('half', FormFieldDisplayWidth::HALF->value);
$this->assertSame('full', FormFieldDisplayWidth::FULL->value);
$this->assertCount(2, FormFieldDisplayWidth::cases());
}
public function test_values_returns_string_array(): void
{
$this->assertSame(['half', 'full'], FormFieldDisplayWidth::values());
}
}

View File

@@ -0,0 +1,90 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormFieldType;
use App\Enums\FormBuilder\FormValueStorageHint;
use PHPUnit\Framework\TestCase;
class FormFieldTypeTest extends TestCase
{
public function test_has_22_cases(): void
{
$this->assertCount(22, FormFieldType::cases());
}
public function test_values_returns_string_array(): void
{
$values = FormFieldType::values();
$this->assertContains('TEXT', $values);
$this->assertContains('SIGNATURE', $values);
$this->assertContains('TABLE_ROWS', $values);
}
public function test_storage_hint_string_types(): void
{
$this->assertSame(FormValueStorageHint::STRING, FormFieldType::TEXT->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::STRING, FormFieldType::TEXTAREA->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::STRING, FormFieldType::EMAIL->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::STRING, FormFieldType::PHONE->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::STRING, FormFieldType::URL->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::STRING, FormFieldType::RADIO->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::STRING, FormFieldType::SELECT->recommendedValueStorageHint());
}
public function test_storage_hint_typed(): void
{
$this->assertSame(FormValueStorageHint::NUMBER, FormFieldType::NUMBER->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::DATE, FormFieldType::DATE->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::DATE, FormFieldType::DATETIME->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::BOOL, FormFieldType::BOOLEAN->recommendedValueStorageHint());
}
public function test_storage_hint_json_default(): void
{
$this->assertSame(FormValueStorageHint::JSON, FormFieldType::MULTISELECT->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::JSON, FormFieldType::CHECKBOX_LIST->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::JSON, FormFieldType::FILE_UPLOAD->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::JSON, FormFieldType::SIGNATURE->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::JSON, FormFieldType::TAG_PICKER->recommendedValueStorageHint());
$this->assertSame(FormValueStorageHint::JSON, FormFieldType::TABLE_ROWS->recommendedValueStorageHint());
}
public function test_is_filterable_true(): void
{
$this->assertTrue(FormFieldType::TEXT->isFilterable());
$this->assertTrue(FormFieldType::SELECT->isFilterable());
$this->assertTrue(FormFieldType::NUMBER->isFilterable());
$this->assertTrue(FormFieldType::BOOLEAN->isFilterable());
$this->assertTrue(FormFieldType::MULTISELECT->isFilterable());
$this->assertTrue(FormFieldType::TAG_PICKER->isFilterable());
}
public function test_is_filterable_false(): void
{
$this->assertFalse(FormFieldType::TEXTAREA->isFilterable());
$this->assertFalse(FormFieldType::FILE_UPLOAD->isFilterable());
$this->assertFalse(FormFieldType::IMAGE_UPLOAD->isFilterable());
$this->assertFalse(FormFieldType::SIGNATURE->isFilterable());
$this->assertFalse(FormFieldType::HEADING->isFilterable());
$this->assertFalse(FormFieldType::PARAGRAPH->isFilterable());
$this->assertFalse(FormFieldType::TABLE_ROWS->isFilterable());
$this->assertFalse(FormFieldType::SECTION_PRIORITY->isFilterable());
$this->assertFalse(FormFieldType::AVAILABILITY_PICKER->isFilterable());
}
public function test_has_value_true_for_inputs(): void
{
$this->assertTrue(FormFieldType::TEXT->hasValue());
$this->assertTrue(FormFieldType::SIGNATURE->hasValue());
$this->assertTrue(FormFieldType::TABLE_ROWS->hasValue());
}
public function test_has_value_false_for_presentational(): void
{
$this->assertFalse(FormFieldType::HEADING->hasValue());
$this->assertFalse(FormFieldType::PARAGRAPH->hasValue());
}
}

View File

@@ -0,0 +1,101 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormPurpose;
use App\Enums\FormBuilder\FormSubmissionMode;
use PHPUnit\Framework\TestCase;
class FormPurposeTest extends TestCase
{
public function test_has_22_cases(): void
{
$this->assertCount(22, FormPurpose::cases());
}
public function test_values_contains_expected_strings(): void
{
$values = FormPurpose::values();
$expected = [
'event_registration', 'user_profile', 'artist_profile', 'company_profile',
'artist_advance', 'supplier_intake', 'incident_report', 'feedback',
'post_event_evaluation', 'signature_contract', 'signature_code_of_conduct',
'signature_receipt', 'absence_report', 'check_out_inventory',
'public_complaint', 'public_press_request', 'public_rsvp',
'onboarding_wizard', 'event_setup_wizard', 'company_custom',
'artist_custom', 'custom',
];
foreach ($expected as $v) {
$this->assertContains($v, $values);
}
}
public function test_default_subject_type_for_person_purposes(): void
{
$this->assertSame('person', FormPurpose::EVENT_REGISTRATION->defaultSubjectType());
$this->assertSame('person', FormPurpose::POST_EVENT_EVALUATION->defaultSubjectType());
$this->assertSame('person', FormPurpose::SIGNATURE_RECEIPT->defaultSubjectType());
$this->assertSame('person', FormPurpose::ABSENCE_REPORT->defaultSubjectType());
$this->assertSame('person', FormPurpose::CHECK_OUT_INVENTORY->defaultSubjectType());
}
public function test_default_subject_type_for_entity_purposes(): void
{
$this->assertSame('user', FormPurpose::USER_PROFILE->defaultSubjectType());
$this->assertSame('artist', FormPurpose::ARTIST_PROFILE->defaultSubjectType());
$this->assertSame('company', FormPurpose::COMPANY_PROFILE->defaultSubjectType());
$this->assertSame('artist', FormPurpose::ARTIST_ADVANCE->defaultSubjectType());
$this->assertSame('company', FormPurpose::SUPPLIER_INTAKE->defaultSubjectType());
$this->assertSame('organisation', FormPurpose::ONBOARDING_WIZARD->defaultSubjectType());
$this->assertSame('event', FormPurpose::EVENT_SETUP_WIZARD->defaultSubjectType());
}
public function test_default_subject_type_is_null_for_public_and_custom(): void
{
$this->assertNull(FormPurpose::PUBLIC_COMPLAINT->defaultSubjectType());
$this->assertNull(FormPurpose::PUBLIC_PRESS_REQUEST->defaultSubjectType());
$this->assertNull(FormPurpose::PUBLIC_RSVP->defaultSubjectType());
$this->assertNull(FormPurpose::CUSTOM->defaultSubjectType());
}
public function test_default_submission_mode_draft_single(): void
{
$this->assertSame(FormSubmissionMode::DRAFT_SINGLE, FormPurpose::EVENT_REGISTRATION->defaultSubmissionMode());
$this->assertSame(FormSubmissionMode::DRAFT_SINGLE, FormPurpose::ARTIST_ADVANCE->defaultSubmissionMode());
$this->assertSame(FormSubmissionMode::DRAFT_SINGLE, FormPurpose::SUPPLIER_INTAKE->defaultSubmissionMode());
}
public function test_default_submission_mode_multiple(): void
{
$this->assertSame(FormSubmissionMode::MULTIPLE, FormPurpose::INCIDENT_REPORT->defaultSubmissionMode());
$this->assertSame(FormSubmissionMode::MULTIPLE, FormPurpose::FEEDBACK->defaultSubmissionMode());
$this->assertSame(FormSubmissionMode::MULTIPLE, FormPurpose::PUBLIC_COMPLAINT->defaultSubmissionMode());
}
public function test_default_submission_mode_single(): void
{
$this->assertSame(FormSubmissionMode::SINGLE, FormPurpose::USER_PROFILE->defaultSubmissionMode());
$this->assertSame(FormSubmissionMode::SINGLE, FormPurpose::ARTIST_PROFILE->defaultSubmissionMode());
$this->assertSame(FormSubmissionMode::SINGLE, FormPurpose::ONBOARDING_WIZARD->defaultSubmissionMode());
$this->assertSame(FormSubmissionMode::SINGLE, FormPurpose::CUSTOM->defaultSubmissionMode());
}
public function test_allows_public_access(): void
{
$this->assertTrue(FormPurpose::PUBLIC_COMPLAINT->allowsPublicAccess());
$this->assertTrue(FormPurpose::PUBLIC_PRESS_REQUEST->allowsPublicAccess());
$this->assertTrue(FormPurpose::PUBLIC_RSVP->allowsPublicAccess());
$this->assertTrue(FormPurpose::ARTIST_ADVANCE->allowsPublicAccess());
$this->assertTrue(FormPurpose::SUPPLIER_INTAKE->allowsPublicAccess());
}
public function test_disallows_public_access(): void
{
$this->assertFalse(FormPurpose::EVENT_REGISTRATION->allowsPublicAccess());
$this->assertFalse(FormPurpose::USER_PROFILE->allowsPublicAccess());
$this->assertFalse(FormPurpose::INCIDENT_REPORT->allowsPublicAccess());
$this->assertFalse(FormPurpose::CUSTOM->allowsPublicAccess());
}
}

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormSchemaSnapshotMode;
use PHPUnit\Framework\TestCase;
class FormSchemaSnapshotModeTest extends TestCase
{
public function test_has_expected_cases(): void
{
$this->assertSame('never', FormSchemaSnapshotMode::NEVER->value);
$this->assertSame('on_submit', FormSchemaSnapshotMode::ON_SUBMIT->value);
$this->assertSame('always', FormSchemaSnapshotMode::ALWAYS->value);
$this->assertCount(3, FormSchemaSnapshotMode::cases());
}
public function test_values_returns_string_array(): void
{
$this->assertSame(['never', 'on_submit', 'always'], FormSchemaSnapshotMode::values());
}
}

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormSubmissionMode;
use PHPUnit\Framework\TestCase;
class FormSubmissionModeTest extends TestCase
{
public function test_has_expected_cases(): void
{
$this->assertSame('single', FormSubmissionMode::SINGLE->value);
$this->assertSame('multiple', FormSubmissionMode::MULTIPLE->value);
$this->assertSame('draft_single', FormSubmissionMode::DRAFT_SINGLE->value);
$this->assertCount(3, FormSubmissionMode::cases());
}
public function test_values_returns_string_array(): void
{
$this->assertSame(['single', 'multiple', 'draft_single'], FormSubmissionMode::values());
}
}

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormSubmissionReviewStatus;
use PHPUnit\Framework\TestCase;
class FormSubmissionReviewStatusTest extends TestCase
{
public function test_has_expected_cases(): void
{
$this->assertCount(4, FormSubmissionReviewStatus::cases());
$this->assertSame('pending_review', FormSubmissionReviewStatus::PENDING_REVIEW->value);
$this->assertSame('approved', FormSubmissionReviewStatus::APPROVED->value);
$this->assertSame('rejected', FormSubmissionReviewStatus::REJECTED->value);
$this->assertSame('changes_requested', FormSubmissionReviewStatus::CHANGES_REQUESTED->value);
}
public function test_values_returns_string_array(): void
{
$this->assertSame(
['pending_review', 'approved', 'rejected', 'changes_requested'],
FormSubmissionReviewStatus::values()
);
}
}

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormSubmissionStatus;
use PHPUnit\Framework\TestCase;
class FormSubmissionStatusTest extends TestCase
{
public function test_has_expected_cases(): void
{
$this->assertSame('draft', FormSubmissionStatus::DRAFT->value);
$this->assertSame('submitted', FormSubmissionStatus::SUBMITTED->value);
$this->assertSame('archived', FormSubmissionStatus::ARCHIVED->value);
$this->assertCount(3, FormSubmissionStatus::cases());
}
public function test_values_returns_array_of_strings(): void
{
$this->assertSame(['draft', 'submitted', 'archived'], FormSubmissionStatus::values());
}
}

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormValueStorageHint;
use PHPUnit\Framework\TestCase;
class FormValueStorageHintTest extends TestCase
{
public function test_has_expected_cases(): void
{
$this->assertSame('json', FormValueStorageHint::JSON->value);
$this->assertSame('string', FormValueStorageHint::STRING->value);
$this->assertSame('number', FormValueStorageHint::NUMBER->value);
$this->assertSame('date', FormValueStorageHint::DATE->value);
$this->assertSame('bool', FormValueStorageHint::BOOL->value);
$this->assertCount(5, FormValueStorageHint::cases());
}
public function test_values_returns_string_array(): void
{
$this->assertSame(
['json', 'string', 'number', 'date', 'bool'],
FormValueStorageHint::values()
);
}
}

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Enums\FormBuilder;
use App\Enums\FormBuilder\FormWebhookDeliveryStatus;
use PHPUnit\Framework\TestCase;
class FormWebhookDeliveryStatusTest extends TestCase
{
public function test_has_expected_cases(): void
{
$this->assertSame('pending', FormWebhookDeliveryStatus::PENDING->value);
$this->assertSame('delivered', FormWebhookDeliveryStatus::DELIVERED->value);
$this->assertSame('failed', FormWebhookDeliveryStatus::FAILED->value);
$this->assertSame('dead_letter', FormWebhookDeliveryStatus::DEAD_LETTER->value);
$this->assertCount(4, FormWebhookDeliveryStatus::cases());
}
public function test_values_returns_string_array(): void
{
$this->assertSame(
['pending', 'delivered', 'failed', 'dead_letter'],
FormWebhookDeliveryStatus::values()
);
}
}