@@ -542,14 +542,21 @@ public function testProcessAppendsNewTokensWhenPersistentTokenModeIsOn()
542542 ->method ('getMethod ' )
543543 ->willReturn ('GET ' );
544544
545+ $ withAttributeCallCount = 0 ;
545546 $ request
546547 ->expects ($ this ->exactly (2 ))
547548 ->method ('withAttribute ' )
548- ->withConsecutive (
549- ['test-name ' , 'test-name123 ' ],
550- ['test-value ' , $ this ->isType ('string ' )]
551- )
552- ->willReturn ($ request );
549+ ->willReturnCallback (function ($ key , $ value ) use ($ request , &$ withAttributeCallCount ) {
550+ $ withAttributeCallCount ++;
551+ if ($ withAttributeCallCount === 1 ) {
552+ $ this ->assertEquals ('test-name ' , $ key );
553+ $ this ->assertEquals ('test-name123 ' , $ value );
554+ } elseif ($ withAttributeCallCount === 2 ) {
555+ $ this ->assertEquals ('test-value ' , $ key );
556+ $ this ->assertIsString ($ value );
557+ }
558+ return $ request ;
559+ });
553560
554561 $ requestHandler = $ this ->createMock (RequestHandlerInterface::class);
555562 $ requestHandler
@@ -618,11 +625,22 @@ public function testTokenFromHeaderOnDelete()
618625 ->expects ($ this ->once ())
619626 ->method ('getParsedBody ' )
620627 ->willReturn ([]);
628+ $ maskedToken = $ this ->maskToken ($ mw , 'test-value123 ' );
629+ $ getHeaderCallCount = 0 ;
621630 $ request
622631 ->expects ($ this ->exactly (2 ))
623632 ->method ('getHeader ' )
624- ->withConsecutive (['test-name ' ], ['test-value ' ])
625- ->willReturnOnConsecutiveCalls (['test-name ' ], [$ this ->maskToken ($ mw , 'test-value123 ' )]);
633+ ->willReturnCallback (function ($ header ) use (&$ getHeaderCallCount , $ maskedToken ) {
634+ $ getHeaderCallCount ++;
635+ if ($ getHeaderCallCount === 1 ) {
636+ $ this ->assertEquals ('test-name ' , $ header );
637+ return ['test-name ' ];
638+ } elseif ($ getHeaderCallCount === 2 ) {
639+ $ this ->assertEquals ('test-value ' , $ header );
640+ return [$ maskedToken ];
641+ }
642+ return [];
643+ });
626644
627645 $ mw ->process ($ request , $ requestHandler );
628646 }
0 commit comments