2121 *
2222 */
2323
24- namespace OCA \Settings \Tests \AppInfo ;
24+ namespace OC \Settings \Tests \AppInfo ;
2525
2626use OC \Settings \AuthorizedGroupMapper ;
2727use OC \Settings \Manager ;
@@ -82,16 +82,26 @@ protected function setUp(): void {
8282 public function testGetAdminSections () {
8383 $ this ->manager ->registerSection ('admin ' , \OCA \WorkflowEngine \Settings \Section::class);
8484
85+ $ section = \OC ::$ server ->query (\OCA \WorkflowEngine \Settings \Section::class);
86+ $ this ->container ->method ('get ' )
87+ ->with (\OCA \WorkflowEngine \Settings \Section::class)
88+ ->willReturn ($ section );
89+
8590 $ this ->assertEquals ([
86- 55 => [\ OC :: $ server -> query (\ OCA \ WorkflowEngine \ Settings \Section::class) ],
91+ 55 => [$ section ],
8792 ], $ this ->manager ->getAdminSections ());
8893 }
8994
9095 public function testGetPersonalSections () {
9196 $ this ->manager ->registerSection ('personal ' , \OCA \WorkflowEngine \Settings \Section::class);
9297
98+ $ section = \OC ::$ server ->query (\OCA \WorkflowEngine \Settings \Section::class);
99+ $ this ->container ->method ('get ' )
100+ ->with (\OCA \WorkflowEngine \Settings \Section::class)
101+ ->willReturn ($ section );
102+
93103 $ this ->assertEquals ([
94- 55 => [\ OC :: $ server -> query (\ OCA \ WorkflowEngine \ Settings \Section::class) ],
104+ 55 => [$ section ],
95105 ], $ this ->manager ->getPersonalSections ());
96106 }
97107
@@ -181,14 +191,16 @@ public function testGetPersonalSettings() {
181191 $ this ->manager ->registerSetting ('personal ' , 'section1 ' );
182192 $ this ->manager ->registerSetting ('personal ' , 'section2 ' );
183193
184- $ this ->container ->expects ($ this ->at ( 0 ))
194+ $ this ->container ->expects ($ this ->exactly ( 2 ))
185195 ->method ('get ' )
186- ->with ('section1 ' )
187- ->willReturn ($ section );
188- $ this ->container ->expects ($ this ->at (1 ))
189- ->method ('get ' )
190- ->with ('section2 ' )
191- ->willReturn ($ section2 );
196+ ->withConsecutive (
197+ ['section1 ' ],
198+ ['section2 ' ]
199+ )
200+ ->willReturnMap ([
201+ ['section1 ' , $ section ],
202+ ['section2 ' , $ section2 ],
203+ ]);
192204
193205 $ settings = $ this ->manager ->getPersonalSettings ('security ' );
194206
@@ -212,12 +224,18 @@ public function testSameSectionAsPersonalAndAdmin() {
212224 $ this ->manager ->registerSection ('personal ' , \OCA \WorkflowEngine \Settings \Section::class);
213225 $ this ->manager ->registerSection ('admin ' , \OCA \WorkflowEngine \Settings \Section::class);
214226
227+
228+ $ section = \OC ::$ server ->query (\OCA \WorkflowEngine \Settings \Section::class);
229+ $ this ->container ->method ('get ' )
230+ ->with (\OCA \WorkflowEngine \Settings \Section::class)
231+ ->willReturn ($ section );
232+
215233 $ this ->assertEquals ([
216- 55 => [\ OC :: $ server -> query (\ OCA \ WorkflowEngine \ Settings \Section::class) ],
234+ 55 => [$ section ],
217235 ], $ this ->manager ->getPersonalSections ());
218236
219237 $ this ->assertEquals ([
220- 55 => [\ OC :: $ server -> query (\ OCA \ WorkflowEngine \ Settings \Section::class) ],
238+ 55 => [$ section ],
221239 ], $ this ->manager ->getAdminSections ());
222240 }
223241}
0 commit comments