assertInstanceOf(JwtIdentity::class, $identity); // Find identity by the legacy OAuth2 token $identity = IdentityFactory::findIdentityByAccessToken('ZZQP8sS9urzriy8N9h6FwFNMOH3PkZ5T5PLqS6SX'); $this->assertInstanceOf(LegacyOAuth2Identity::class, $identity); } public function testFindIdentityByAccessTokenWithEmptyValue() { $this->expectException(UnauthorizedHttpException::class); $this->expectExceptionMessage('Incorrect token'); IdentityFactory::findIdentityByAccessToken(''); } protected function _setUp() { parent::_setUp(); Carbon::setTestNow(Carbon::create(2019, 8, 1, 1, 2, 22, 'Europe/Minsk')); } protected function _tearDown() { parent::_tearDown(); Carbon::setTestNow(); } }