88namespace OCA \User_LDAP \Tests ;
99
1010use OCA \User_LDAP \Helper ;
11- use OCP \AppFramework \ Services \ IAppConfig ;
11+ use OCP \IAppConfig ;
1212use OCP \IDBConnection ;
1313use OCP \Server ;
1414use PHPUnit \Framework \MockObject \MockObject ;
@@ -32,36 +32,38 @@ protected function setUp(): void {
3232 }
3333
3434 public function testGetServerConfigurationPrefixes (): void {
35- $ this ->appConfig ->method ('getAppKeys ' )
35+ $ this ->appConfig ->method ('getKeys ' )
36+ ->with ('user_ldap ' )
3637 ->willReturn ([
3738 'foo ' ,
3839 'ldap_configuration_active ' ,
3940 's1ldap_configuration_active ' ,
4041 ]);
4142
42- $ this ->appConfig ->method ('getAppValueArray ' )
43- ->with ('configuration_prefixes ' )
44- -> willReturnArgument (1 );
43+ $ this ->appConfig ->method ('getValueArray ' )
44+ ->with ('user_ldap ' , ' configuration_prefixes ' )
45+ -> willReturnArgument (2 );
4546
4647 $ result = $ this ->helper ->getServerConfigurationPrefixes (false );
4748
4849 $ this ->assertEquals (['' , 's1 ' ], $ result );
4950 }
5051
5152 public function testGetServerConfigurationPrefixesActive (): void {
52- $ this ->appConfig ->method ('getAppKeys ' )
53+ $ this ->appConfig ->method ('getKeys ' )
54+ ->with ('user_ldap ' )
5355 ->willReturn ([
5456 'foo ' ,
5557 'ldap_configuration_active ' ,
5658 's1ldap_configuration_active ' ,
5759 ]);
5860
59- $ this ->appConfig ->method ('getAppValueArray ' )
60- ->with ('configuration_prefixes ' )
61- -> willReturnArgument (1 );
61+ $ this ->appConfig ->method ('getValueArray ' )
62+ ->with ('user_ldap ' , ' configuration_prefixes ' )
63+ -> willReturnArgument (2 );
6264
63- $ this ->appConfig ->method ('getAppValueString ' )
64- ->willReturnCallback (function ($ key , $ default ) {
65+ $ this ->appConfig ->method ('getValueString ' )
66+ ->willReturnCallback (function ($ app , $ key , $ default ) {
6567 if ($ key === 's1ldap_configuration_active ' ) {
6668 return '1 ' ;
6769 }
@@ -74,7 +76,8 @@ public function testGetServerConfigurationPrefixesActive(): void {
7476 }
7577
7678 public function testGetServerConfigurationHostFromAppKeys (): void {
77- $ this ->appConfig ->method ('getAppKeys ' )
79+ $ this ->appConfig ->method ('getKeys ' )
80+ ->with ('user_ldap ' )
7881 ->willReturn ([
7982 'foo ' ,
8083 'ldap_host ' ,
@@ -85,12 +88,12 @@ public function testGetServerConfigurationHostFromAppKeys(): void {
8588 's02ldap_configuration_active ' ,
8689 ]);
8790
88- $ this ->appConfig ->method ('getAppValueArray ' )
89- ->with ('configuration_prefixes ' )
90- -> willReturnArgument (1 );
91+ $ this ->appConfig ->method ('getValueArray ' )
92+ ->with ('user_ldap ' , ' configuration_prefixes ' )
93+ -> willReturnArgument (2 );
9194
92- $ this ->appConfig ->method ('getAppValueString ' )
93- ->willReturnCallback (function ($ key , $ default ) {
95+ $ this ->appConfig ->method ('getValueString ' )
96+ ->willReturnCallback (function ($ app , $ key , $ default ) {
9497 if ($ key === 'ldap_host ' ) {
9598 return 'example.com ' ;
9699 }
@@ -112,18 +115,18 @@ public function testGetServerConfigurationHostFromAppKeys(): void {
112115 public function testGetServerConfigurationHost (): void {
113116 $ this ->appConfig
114117 ->expects (self ::never ())
115- ->method ('getAppKeys ' );
118+ ->method ('getKeys ' );
116119
117- $ this ->appConfig ->method ('getAppValueArray ' )
118- ->with ('configuration_prefixes ' )
120+ $ this ->appConfig ->method ('getValueArray ' )
121+ ->with ('user_ldap ' , ' configuration_prefixes ' )
119122 -> willReturn ([
120123 '' ,
121124 's1 ' ,
122125 's02 ' ,
123126 ]);
124127
125- $ this ->appConfig ->method ('getAppValueString ' )
126- ->willReturnCallback (function ($ key , $ default ) {
128+ $ this ->appConfig ->method ('getValueString ' )
129+ ->willReturnCallback (function ($ app , $ key , $ default ) {
127130 if ($ key === 'ldap_host ' ) {
128131 return 'example.com ' ;
129132 }
0 commit comments