@@ -47,6 +47,13 @@ class AppConfigTest extends TestCase {
4747 'deletethis ' => ['deletethis ' , 'deletethis ' ],
4848 'key ' => ['key ' , 'value ' ]
4949 ],
50+ 'searchtest ' => [
51+ 'search_key1 ' => ['search_key1 ' , 'key1 ' , IAppConfig::VALUE_STRING ],
52+ 'search_key2 ' => ['search_key2 ' , 'key2 ' , IAppConfig::VALUE_STRING ],
53+ 'search_key3 ' => ['search_key3 ' , 'key3 ' , IAppConfig::VALUE_STRING ],
54+ 'searchnot_key4 ' => ['searchnot_key4 ' , 'key4 ' , IAppConfig::VALUE_STRING ],
55+ 'search_key5_lazy ' => ['search_key5_lazy ' , 'key5 ' , IAppConfig::VALUE_STRING , true ],
56+ ],
5057 'someapp ' => [
5158 'key ' => ['key ' , 'value ' ],
5259 'otherkey ' => ['otherkey ' , 'othervalue ' ]
@@ -1454,6 +1461,23 @@ public function testUpdateNonSensitiveValueToSensitiveWithUpdateSensitive(): voi
14541461 $ this ->assertConfigValueNotEquals ('testapp ' , $ key , $ secret );
14551462 }
14561463
1464+ public function testSearchKeyNoLazyLoading (): void {
1465+ $ appConfig = $ this ->generateAppConfig ();
1466+ $ appConfig ->searchKeys ('searchtest ' , 'search_ ' );
1467+ $ status = $ appConfig ->statusCache ();
1468+ $ this ->assertFalse ($ status ['lazyLoaded ' ], 'searchKeys() loaded lazy config ' );
1469+ }
1470+
1471+ public function testSearchKeyFast (): void {
1472+ $ appConfig = $ this ->generateAppConfig ();
1473+ $ this ->assertEquals (['search_key1 ' , 'search_key2 ' , 'search_key3 ' ], $ appConfig ->searchKeys ('searchtest ' , 'search_ ' ));
1474+ }
1475+
1476+ public function testSearchKeyLazy (): void {
1477+ $ appConfig = $ this ->generateAppConfig ();
1478+ $ this ->assertEquals (['search_key5_lazy ' ], $ appConfig ->searchKeys ('searchtest ' , 'search_ ' , true ));
1479+ }
1480+
14571481 protected function loadConfigValueFromDatabase (string $ app , string $ key ): string |false {
14581482 $ sql = $ this ->connection ->getQueryBuilder ();
14591483 $ sql ->select ('configvalue ' )
0 commit comments