@@ -44,6 +44,13 @@ class AppConfigTest extends TestCase {
4444 'deletethis ' => ['deletethis ' , 'deletethis ' ],
4545 'key ' => ['key ' , 'value ' ]
4646 ],
47+ 'searchtest ' => [
48+ 'search_key1 ' => ['search_key1 ' , 'key1 ' , IAppConfig::VALUE_STRING ],
49+ 'search_key2 ' => ['search_key2 ' , 'key2 ' , IAppConfig::VALUE_STRING ],
50+ 'search_key3 ' => ['search_key3 ' , 'key3 ' , IAppConfig::VALUE_STRING ],
51+ 'searchnot_key4 ' => ['searchnot_key4 ' , 'key4 ' , IAppConfig::VALUE_STRING ],
52+ 'search_key5_lazy ' => ['search_key5_lazy ' , 'key5 ' , IAppConfig::VALUE_STRING , true ],
53+ ],
4754 'someapp ' => [
4855 'key ' => ['key ' , 'value ' ],
4956 'otherkey ' => ['otherkey ' , 'othervalue ' ]
@@ -1439,6 +1446,23 @@ public function testUpdateNonSensitiveValueToSensitiveWithUpdateSensitive(): voi
14391446 $ this ->assertConfigValueNotEquals ('testapp ' , $ key , $ secret );
14401447 }
14411448
1449+ public function testSearchKeyNoLazyLoading (): void {
1450+ $ appConfig = $ this ->generateAppConfig ();
1451+ $ appConfig ->searchKeys ('searchtest ' , 'search_ ' );
1452+ $ status = $ appConfig ->statusCache ();
1453+ $ this ->assertFalse ($ status ['lazyLoaded ' ], 'searchKeys() loaded lazy config ' );
1454+ }
1455+
1456+ public function testSearchKeyFast (): void {
1457+ $ appConfig = $ this ->generateAppConfig ();
1458+ $ this ->assertEquals (['search_key1 ' , 'search_key2 ' , 'search_key3 ' ], $ appConfig ->searchKeys ('searchtest ' , 'search_ ' ));
1459+ }
1460+
1461+ public function testSearchKeyLazy (): void {
1462+ $ appConfig = $ this ->generateAppConfig ();
1463+ $ this ->assertEquals (['search_key5_lazy ' ], $ appConfig ->searchKeys ('searchtest ' , 'search_ ' , true ));
1464+ }
1465+
14421466 protected function loadConfigValueFromDatabase (string $ app , string $ key ): string |false {
14431467 $ sql = $ this ->connection ->getQueryBuilder ();
14441468 $ sql ->select ('configvalue ' )
0 commit comments