@@ -58,32 +58,36 @@ public function testMigratesLegacyFooterSettingsIntoStructuredPayload(): void {
5858 $ deletedKeys = [];
5959
6060 $ this ->appConfig
61- ->expects ($ this ->once ())
61+ ->expects ($ this ->atLeastOnce ())
6262 ->method ('deleteKey ' )
6363 ->willReturnCallback (static function (string $ app , string $ key ) use (&$ deletedKeys ): void {
6464 $ deletedKeys [] = [$ app , $ key ];
6565 });
6666
6767 $ this ->appConfig
68- ->expects ($ this ->once ())
68+ ->expects ($ this ->atLeastOnce ())
6969 ->method ('setValueString ' )
70- ->with (
71- Application::APP_ID ,
72- 'add_footer ' ,
73- FooterPolicyValue::encode ([
74- 'enabled ' => true ,
75- 'writeQrcodeOnFooter ' => false ,
76- 'validationSite ' => 'https://validator.example/base/ ' ,
77- 'customizeFooterTemplate ' => true ,
78- ]),
79- );
70+ ->willReturnCallback (static function (string $ app , string $ key , string $ value ): bool {
71+ if ($ key === 'add_footer ' ) {
72+ TestCase::assertSame (Application::APP_ID , $ app );
73+ TestCase::assertSame (
74+ FooterPolicyValue::encode ([
75+ 'enabled ' => true ,
76+ 'writeQrcodeOnFooter ' => false ,
77+ 'validationSite ' => 'https://validator.example/base/ ' ,
78+ 'customizeFooterTemplate ' => true ,
79+ ]),
80+ $ value ,
81+ );
82+ }
83+
84+ return true ;
85+ });
8086
8187 $ migration = new Version18001Date20260320000000 ($ this ->appConfig );
8288 $ migration ->preSchemaChange ($ this ->createMock (IOutput::class), static fn () => null , []);
8389
84- self ::assertSame ([
85- [Application::APP_ID , 'add_footer ' ],
86- ], $ deletedKeys );
90+ self ::assertContains ([Application::APP_ID , 'add_footer ' ], $ deletedKeys );
8791 }
8892
8993 public function testReadsLegacyBooleanWhenAddFooterHasTypedBoolValue (): void {
@@ -149,25 +153,29 @@ public function testReadsLegacyBooleanWhenAddFooterHasTypedBoolValue(): void {
149153 });
150154
151155 $ this ->appConfig
152- ->expects ($ this ->once ())
156+ ->expects ($ this ->atLeastOnce ())
153157 ->method ('setValueString ' )
154- ->with (
155- Application::APP_ID ,
156- 'add_footer ' ,
157- FooterPolicyValue::encode ([
158- 'enabled ' => false ,
159- 'writeQrcodeOnFooter ' => true ,
160- 'validationSite ' => '' ,
161- 'customizeFooterTemplate ' => false ,
162- ]),
163- );
158+ ->willReturnCallback (static function (string $ app , string $ key , string $ value ): bool {
159+ if ($ key === 'add_footer ' ) {
160+ TestCase::assertSame (Application::APP_ID , $ app );
161+ TestCase::assertSame (
162+ FooterPolicyValue::encode ([
163+ 'enabled ' => false ,
164+ 'writeQrcodeOnFooter ' => true ,
165+ 'validationSite ' => '' ,
166+ 'customizeFooterTemplate ' => false ,
167+ ]),
168+ $ value ,
169+ );
170+ }
171+
172+ return true ;
173+ });
164174
165175 $ migration = new Version18001Date20260320000000 ($ this ->appConfig );
166176 $ migration ->preSchemaChange ($ this ->createMock (IOutput::class), static fn () => null , []);
167177
168- self ::assertSame ([
169- [Application::APP_ID , 'add_footer ' ],
170- ], $ deletedKeys );
178+ self ::assertContains ([Application::APP_ID , 'add_footer ' ], $ deletedKeys );
171179 }
172180
173181 public function testMigratesGroupsRequestSignFromTypedArrayToCanonicalString (): void {
@@ -251,14 +259,6 @@ public function testMigratesSignatureTextFloatSettingsFromLegacyStrings(): void
251259 $ deleted [] = [$ app , $ key ];
252260 });
253261
254- $ savedFloats = [];
255- $ this ->appConfig
256- ->method ('setValueFloat ' )
257- ->willReturnCallback (static function (string $ app , string $ key , float $ value ) use (&$ savedFloats ): bool {
258- $ savedFloats [$ key ] = $ value ;
259- return true ;
260- });
261-
262262 $ savedStrings = [];
263263 $ this ->appConfig
264264 ->method ('setValueString ' )
@@ -270,10 +270,13 @@ public function testMigratesSignatureTextFloatSettingsFromLegacyStrings(): void
270270 $ migration = new Version18001Date20260320000000 ($ this ->appConfig );
271271 $ migration ->preSchemaChange ($ this ->createMock (IOutput::class), static fn () => null , []);
272272
273- self ::assertSame (11.5 , $ savedFloats [SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_TEMPLATE_FONT_SIZE ]);
274- self ::assertSame (350.0 , $ savedFloats [SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_SIGNATURE_WIDTH ]);
275- self ::assertSame (100.25 , $ savedFloats [SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_SIGNATURE_HEIGHT ]);
276- self ::assertSame (18.0 , $ savedFloats [SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_SIGNATURE_FONT_SIZE ]);
273+ self ::assertArrayHasKey (SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY , $ savedStrings );
274+ $ decoded = json_decode ($ savedStrings [SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY ], true );
275+ self ::assertIsArray ($ decoded );
276+ self ::assertSame (11.5 , $ decoded ['template_font_size ' ]);
277+ self ::assertEquals (350.0 , $ decoded ['signature_width ' ]);
278+ self ::assertSame (100.25 , $ decoded ['signature_height ' ]);
279+ self ::assertEquals (18.0 , $ decoded ['signature_font_size ' ]);
277280 self ::assertContains ([Application::APP_ID , SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_TEMPLATE_FONT_SIZE ], $ deleted );
278281 self ::assertContains ([Application::APP_ID , SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_SIGNATURE_WIDTH ], $ deleted );
279282 self ::assertContains ([Application::APP_ID , SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_SIGNATURE_HEIGHT ], $ deleted );
@@ -321,28 +324,21 @@ public function testNormalizesSignatureTextRenderModeToCanonicalPolicyValue(): v
321324 $ this ->appConfig
322325 ->method ('setValueString ' )
323326 ->willReturnCallback (static function (string $ app , string $ key , string $ value ) use (&$ renderModeWasNormalized ): bool {
324- if ($ key === SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_RENDER_MODE ) {
327+ if ($ key === SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY ) {
325328 TestCase::assertSame (Application::APP_ID , $ app );
326- TestCase::assertSame ('default ' , $ value );
329+ $ decoded = json_decode ($ value , true );
330+ TestCase::assertIsArray ($ decoded );
331+ TestCase::assertSame ('default ' , $ decoded ['render_mode ' ] ?? null );
327332 $ renderModeWasNormalized = true ;
328333 }
329334 return true ;
330335 });
331336
332- $ savedFloats = [];
333- $ this ->appConfig
334- ->method ('setValueFloat ' )
335- ->willReturnCallback (static function (string $ app , string $ key , float $ value ) use (&$ savedFloats ): bool {
336- $ savedFloats [$ key ] = $ value ;
337- return true ;
338- });
339-
340337 $ migration = new Version18001Date20260320000000 ($ this ->appConfig );
341338 $ migration ->preSchemaChange ($ this ->createMock (IOutput::class), static fn () => null , []);
342339
343340 self ::assertTrue ($ renderModeWasNormalized );
344341 self ::assertContains ([Application::APP_ID , SignatureTextPolicy::SYSTEM_APP_CONFIG_KEY_RENDER_MODE ], $ deleted );
345- self ::assertSame ([], $ savedFloats );
346342 }
347343
348344 public function testMigratesPendingBooleanPoliciesFromLegacyStrings (): void {
0 commit comments