2727use Cake \Http \ServerRequestFactory ;
2828use Cake \Http \Session ;
2929use Cake \ORM \TableRegistry ;
30+ use PHPUnit \Runner \Version ;
3031use Psr \Http \Message \RequestInterface ;
3132use Psr \Http \Message \ResponseInterface ;
3233
@@ -203,9 +204,15 @@ public function testAuthenticateFailure()
203204 * Test successful session data verification by database lookup
204205 *
205206 * @return void
207+ * @deprecated The `identify` option is deprecated.
206208 */
207209 public function testVerifyByDatabaseSuccess ()
208210 {
211+ $ this ->skipIf (
212+ version_compare (Version::id (), '11.0 ' , '< ' ),
213+ 'For some reason PHPUnit doesn \'t pick up the deprecation on v10 ' ,
214+ );
215+
209216 $ request = ServerRequestFactory::fromGlobals (['REQUEST_URI ' => '/ ' ]);
210217
211218 $ this ->sessionMock ->expects ($ this ->once ())
@@ -221,19 +228,27 @@ public function testVerifyByDatabaseSuccess()
221228 $ authenticator = new SessionAuthenticator ($ this ->identifiers , [
222229 'identify ' => true ,
223230 ]);
224- $ result = $ authenticator ->authenticate ($ request );
231+ $ this ->deprecated (function () use ($ authenticator , $ request ) {
232+ $ result = $ authenticator ->authenticate ($ request );
225233
226- $ this ->assertInstanceOf (Result::class, $ result );
227- $ this ->assertSame (Result::SUCCESS , $ result ->getStatus ());
234+ $ this ->assertInstanceOf (Result::class, $ result );
235+ $ this ->assertSame (Result::SUCCESS , $ result ->getStatus ());
236+ });
228237 }
229238
230239 /**
231240 * Test session data verification by database lookup failure
232241 *
233242 * @return void
243+ * @deprecated The `identify` option is deprecated.
234244 */
235245 public function testVerifyByDatabaseFailure ()
236246 {
247+ $ this ->skipIf (
248+ version_compare (Version::id (), '11.0 ' , '< ' ),
249+ 'For some reason PHPUnit doesn \'t pick up the deprecation on v10 ' ,
250+ );
251+
237252 $ request = ServerRequestFactory::fromGlobals (['REQUEST_URI ' => '/ ' ]);
238253
239254 $ this ->sessionMock ->expects ($ this ->once ())
@@ -249,10 +264,12 @@ public function testVerifyByDatabaseFailure()
249264 $ authenticator = new SessionAuthenticator ($ this ->identifiers , [
250265 'identify ' => true ,
251266 ]);
252- $ result = $ authenticator ->authenticate ($ request );
267+ $ this ->deprecated (function () use ($ authenticator , $ request ) {
268+ $ result = $ authenticator ->authenticate ($ request );
253269
254- $ this ->assertInstanceOf (Result::class, $ result );
255- $ this ->assertSame (Result::FAILURE_CREDENTIALS_INVALID , $ result ->getStatus ());
270+ $ this ->assertInstanceOf (Result::class, $ result );
271+ $ this ->assertSame (Result::FAILURE_CREDENTIALS_INVALID , $ result ->getStatus ());
272+ });
256273 }
257274
258275 /**
0 commit comments