$asUsername]); if ($account === null) { throw new InvalidArgumentException("Cannot find account for username \"$asUsername\""); } $result = Yii::$app->user->login($account); $this->amBearerAuthenticated($result->getJwt()); } public function notLoggedIn() { $this->haveHttpHeader('Authorization', null); } public function canSeeAuthCredentials($expectRefresh = false) { $this->canSeeResponseJsonMatchesJsonPath('$.access_token'); $this->canSeeResponseJsonMatchesJsonPath('$.expires_in'); if ($expectRefresh) { $this->canSeeResponseJsonMatchesJsonPath('$.refresh_token'); } else { $this->cantSeeResponseJsonMatchesJsonPath('$.refresh_token'); } } }