@@ -134,15 +134,15 @@ public function testShowAuthPickerPageNoClientOrOauthRequest() {
134134
135135 public function testShowAuthPickerPageWithOcsHeader () {
136136 $ this ->request
137- ->expects ($ this ->at (0 ))
138137 ->method ('getHeader ' )
139- ->with ('USER_AGENT ' )
140- ->willReturn ('Mac OS X Sync Client ' );
141- $ this ->request
142- ->expects ($ this ->at (1 ))
143- ->method ('getHeader ' )
144- ->with ('OCS-APIREQUEST ' )
145- ->willReturn ('true ' );
138+ ->withConsecutive (
139+ ['USER_AGENT ' ],
140+ ['OCS-APIREQUEST ' ]
141+ )
142+ ->willReturnMap ([
143+ ['USER_AGENT ' , 'Mac OS X Sync Client ' ],
144+ ['OCS-APIREQUEST ' , 'true ' ],
145+ ]);
146146 $ this ->random
147147 ->expects ($ this ->once ())
148148 ->method ('generate ' )
@@ -196,10 +196,15 @@ public function testShowAuthPickerPageWithOcsHeader() {
196196
197197 public function testShowAuthPickerPageWithOauth () {
198198 $ this ->request
199- ->expects ($ this ->at (0 ))
200199 ->method ('getHeader ' )
201- ->with ('USER_AGENT ' )
202- ->willReturn ('Mac OS X Sync Client ' );
200+ ->withConsecutive (
201+ ['USER_AGENT ' ],
202+ ['OCS-APIREQUEST ' ]
203+ )
204+ ->willReturnMap ([
205+ ['USER_AGENT ' , 'Mac OS X Sync Client ' ],
206+ ['OCS-APIREQUEST ' , 'false ' ],
207+ ]);
203208 $ client = new Client ();
204209 $ client ->setName ('My external service ' );
205210 $ client ->setRedirectUri ('https://example.com/redirect.php ' );
@@ -413,23 +418,21 @@ public function testGeneratePasswordWithPassword() {
413418 */
414419 public function testGeneratePasswordWithPasswordForOauthClient ($ redirectUri , $ redirectUrl ) {
415420 $ this ->session
416- ->expects ($ this ->at (0 ))
417421 ->method ('get ' )
418- ->with ('client.flow.state.token ' )
419- ->willReturn ('MyStateToken ' );
420- $ this ->session
421- ->expects ($ this ->at (1 ))
422- ->method ('remove ' )
423- ->with ('client.flow.state.token ' );
424- $ this ->session
425- ->expects ($ this ->at (3 ))
426- ->method ('get ' )
427- ->with ('oauth.state ' )
428- ->willReturn ('MyOauthState ' );
422+ ->withConsecutive (
423+ ['client.flow.state.token ' ],
424+ ['oauth.state ' ]
425+ )
426+ ->willReturnMap ([
427+ ['client.flow.state.token ' , 'MyStateToken ' ],
428+ ['oauth.state ' , 'MyOauthState ' ],
429+ ]);
429430 $ this ->session
430- ->expects ($ this ->at (4 ))
431431 ->method ('remove ' )
432- ->with ('oauth.state ' );
432+ ->withConsecutive (
433+ ['client.flow.state.token ' ],
434+ ['oauth.state ' ]
435+ );
433436 $ this ->session
434437 ->expects ($ this ->once ())
435438 ->method ('getId ' )
@@ -450,15 +453,15 @@ public function testGeneratePasswordWithPasswordForOauthClient($redirectUri, $re
450453 ->with ($ myToken , 'SessionId ' )
451454 ->willReturn ('MyPassword ' );
452455 $ this ->random
453- ->expects ($ this ->at (0 ))
454456 ->method ('generate ' )
455- ->with (72 )
456- ->willReturn ('MyGeneratedToken ' );
457- $ this ->random
458- ->expects ($ this ->at (1 ))
459- ->method ('generate ' )
460- ->with (128 )
461- ->willReturn ('MyAccessCode ' );
457+ ->withConsecutive (
458+ [72 ],
459+ [128 ]
460+ )
461+ ->willReturnMap ([
462+ [72 , ISecureRandom::CHAR_UPPER .ISecureRandom::CHAR_LOWER .ISecureRandom::CHAR_DIGITS , 'MyGeneratedToken ' ],
463+ [128 , ISecureRandom::CHAR_UPPER .ISecureRandom::CHAR_LOWER .ISecureRandom::CHAR_DIGITS , 'MyAccessCode ' ],
464+ ]);
462465 $ user = $ this ->createMock (IUser::class);
463466 $ user
464467 ->expects ($ this ->once ())
0 commit comments