refactor(form-builder): strict validator on save; strip rules.unique fallback

This commit is contained in:
2026-04-24 22:26:44 +02:00
parent 800b1b6c01
commit 64ec4bcc5c
12 changed files with 469 additions and 29 deletions

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\FormBuilder\ValidationRules;
use PHPUnit\Framework\TestCase;
/**
* WS-5b consolidation static guard that the legacy
* `validation_rules.unique` JSON fallback has been stripped from
* `FormValueService`. The is_unique column is the single source of truth.
*
* We assert the textual absence rather than a behavioural test: uniqueness
* enforcement is heavily coupled to the FormValueObserver typed-column
* write path, submission status, etc. The cheap + high-signal check is
* "the code no longer references `$rules['unique']`".
*/
final class UniqueJsonFallbackRemovedTest extends TestCase
{
public function test_form_value_service_no_longer_reads_rules_unique_key(): void
{
$source = (string) file_get_contents(
__DIR__.'/../../../../app/Services/FormBuilder/FormValueService.php',
);
$this->assertStringNotContainsString("\$rules['unique']", $source);
$this->assertStringNotContainsString('$rules["unique"]', $source);
}
}