login('Admin', 'password_0'); } elseif ($login !== null && $password !== null) { $route->login($login, $password); } else { throw new InvalidArgumentException('login and password should be presented both.'); } $this->canSeeResponseIsJson(); $this->canSeeAuthCredentials(false); $jwt = $this->grabDataFromResponseByJsonPath('$.access_token')[0]; $this->amBearerAuthenticated($jwt); } 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'); } } }