File tree Expand file tree Collapse file tree
tests/php/Unit/Service/Policy/Model Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,4 +75,30 @@ public function testValidationUsesProvidedContext(): void {
7575 $ this ->expectException (\InvalidArgumentException::class);
7676 $ spec ->validateValue ('parallel ' , new PolicyContext ());
7777 }
78+
79+ public function testValidationAllowsAnyValueWhenAllowedValuesIsEmpty (): void {
80+ $ spec = new PolicySpec (
81+ key: 'signature_text_template ' ,
82+ defaultSystemValue: '' ,
83+ allowedValues: [],
84+ );
85+
86+ $ spec ->validateValue ('any free text ' , new PolicyContext ());
87+ $ spec ->validateValue (12.5 , new PolicyContext ());
88+
89+ $ this ->addToAssertionCount (1 );
90+ }
91+
92+ public function testValidationStillRejectsValueWhenAllowedValuesIsDefined (): void {
93+ $ spec = new PolicySpec (
94+ key: 'signature_render_mode ' ,
95+ defaultSystemValue: 'default ' ,
96+ allowedValues: ['default ' , 'graphic ' , 'text ' ],
97+ );
98+
99+ $ spec ->validateValue ('graphic ' , new PolicyContext ());
100+
101+ $ this ->expectException (\InvalidArgumentException::class);
102+ $ spec ->validateValue ('unsupported_mode ' , new PolicyContext ());
103+ }
78104}
You can’t perform that action at this time.
0 commit comments