File tree Expand file tree Collapse file tree
tests/php/Unit/Service/IdentifyMethod Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99namespace OCA \Libresign \Tests \Unit \Service \IdentifyMethod ;
1010
11+ use OCA \Libresign \AppInfo \Application ;
1112use OCA \Libresign \Db \File ;
1213use OCA \Libresign \Db \FileMapper ;
1314use OCA \Libresign \Db \IdentifyMethod ;
@@ -153,4 +154,24 @@ public function testPropagateIdentifiedDateSkipsCurrentRequestAndUpdatesSiblings
153154
154155 $ this ->service ->save ($ identifyMethod );
155156 }
157+
158+ public function testGetSavedSettingsFallsBackToDefaultWhenStoredValueIsInvalid (): void {
159+ $ this ->appConfig
160+ ->expects ($ this ->once ())
161+ ->method ('getValueArray ' )
162+ ->with (Application::APP_ID , 'identify_methods ' , [])
163+ ->willThrowException (new \TypeError ('Invalid app config value type ' ));
164+
165+ $ this ->logger
166+ ->expects ($ this ->once ())
167+ ->method ('warning ' )
168+ ->with (
169+ 'Invalid identify_methods app config; falling back to defaults. ' ,
170+ $ this ->callback (static function (array $ context ): bool {
171+ return isset ($ context ['exception ' ]) && $ context ['exception ' ] instanceof \TypeError;
172+ })
173+ );
174+
175+ $ this ->assertSame ([], $ this ->service ->getSavedSettings ());
176+ }
156177}
You can’t perform that action at this time.
0 commit comments