Improve tests coverage

This commit is contained in:
ErickSkrauch
2019-08-02 18:32:08 +03:00
parent d9f2b1a8c9
commit 967d8b11a0
7 changed files with 133 additions and 10 deletions

View File

@@ -20,7 +20,7 @@ class IdentityFactory {
return JwtIdentity::findIdentityByAccessToken($token, $type);
}
return Oauth2Identity::findIdentityByAccessToken($token, $type);
return OAuth2Identity::findIdentityByAccessToken($token, $type);
}
}

View File

@@ -10,7 +10,7 @@ use Yii;
use yii\base\NotSupportedException;
use yii\web\UnauthorizedHttpException;
class Oauth2Identity implements IdentityInterface {
class OAuth2Identity implements IdentityInterface {
/**
* @var AccessTokenEntity
@@ -55,6 +55,7 @@ class Oauth2Identity implements IdentityInterface {
return $this->_accessToken->getId();
}
// @codeCoverageIgnoreStart
public function getAuthKey() {
throw new NotSupportedException('This method used for cookie auth, except we using Bearer auth');
}
@@ -67,8 +68,10 @@ class Oauth2Identity implements IdentityInterface {
throw new NotSupportedException('This method used for cookie auth, except we using Bearer auth');
}
// @codeCoverageIgnoreEnd
private function getSession(): OauthSession {
return OauthSession::findOne($this->_accessToken->getSessionId());
return OauthSession::findOne(['id' => $this->_accessToken->getSessionId()]);
}
}