@@ -136,20 +136,19 @@ public function testHeaderHappy()
136
136
->setMethods (['getHeader ' ])
137
137
->getMock ();
138
138
139
- $ request ->expects ($ this ->at (0 ))
140
- ->method ('getHeader ' )
141
- ->with ('provider ' )
142
- ->will ($ this ->returnValue (['Facebook ' ]));
143
-
144
- $ request ->expects ($ this ->at (1 ))
145
- ->method ('getHeader ' )
146
- ->with ('token ' )
147
- ->will ($ this ->returnValue (['token-1234 ' ]));
148
-
149
- $ request ->expects ($ this ->at (2 ))
150
- ->method ('getHeader ' )
151
- ->with ('token_secret ' )
152
- ->will ($ this ->returnValue (['token-secret ' ]));
139
+ $ request ->expects ($ this ->exactly (3 ))
140
+ ->method ('getHeader ' )
141
+ ->withConsecutive (
142
+ ['provider ' ],
143
+ ['token ' ],
144
+ ['token_secret ' ],
145
+ )
146
+ ->willReturnOnConsecutiveCalls (
147
+ $ this ->returnValue (['Facebook ' ]),
148
+ $ this ->returnValue (['token-1234 ' ]),
149
+ $ this ->returnValue (['token-secret ' ]),
150
+ );
151
+
153
152
$ this ->social ->setConfig ('type ' , 'header ' );
154
153
$ result = $ this ->social ->authenticate ($ request , new Response ());
155
154
$ this ->assertEquals ('user-1 ' , $ result ['username ' ]);
@@ -165,20 +164,19 @@ public function testAuthenticateHeaderFail()
165
164
$ request = $ this ->getMockBuilder (\Cake \Http \ServerRequest::class)
166
165
->setMethods (['getHeader ' ])
167
166
->getMock ();
168
- $ request ->expects ($ this ->at (0 ))
169
- ->method ('getHeader ' )
170
- ->with ('provider ' )
171
- ->will ($ this ->returnValue (['wrong ' ]));
172
-
173
- $ request ->expects ($ this ->at (1 ))
174
- ->method ('getHeader ' )
175
- ->with ('token ' )
176
- ->will ($ this ->returnValue (['wrong ' ]));
177
-
178
- $ request ->expects ($ this ->at (2 ))
179
- ->method ('getHeader ' )
180
- ->with ('token_secret ' )
181
- ->will ($ this ->returnValue (['wrong ' ]));
167
+ $ request ->expects ($ this ->exactly (3 ))
168
+ ->method ('getHeader ' )
169
+ ->withConsecutive (
170
+ [$ this ->equalTo ('provider ' )],
171
+ [$ this ->equalTo ('token ' )],
172
+ [$ this ->equalTo ('token_secret ' )],
173
+ )
174
+ ->willReturnOnConsecutiveCalls (
175
+ $ this ->returnValue (['wrong ' ]),
176
+ $ this ->returnValue (['wrong ' ]),
177
+ $ this ->returnValue (['wrong ' ]),
178
+ );
179
+
182
180
$ this ->social ->setConfig ('type ' , 'header ' );
183
181
$ result = $ this ->social ->authenticate ($ request , new Response ());
184
182
$ this ->assertFalse ($ result );
0 commit comments