public function testGetAccessTokenServiceNotAnnApp() { $req = new \google\appengine\GetAccessTokenRequest(); $scope = 'mail.google.com/send'; $req->addScope($scope); $exception = new \google\appengine\runtime\ApplicationError(ErrorCode::NOT_A_VALID_APP, "unknown scope"); $this->setExpectedException('\\google\\appengine\\api\\app_identity\\AppIdentityException', 'The application is not valid.'); $this->apiProxyMock->expectCall('app_identity_service', 'GetAccessToken', $req, $exception); $result = AppIdentityService::getAccessToken($scope); }
private function executeServiceErrorTest($error, $expected_response) { $req = new \google\appengine\GetAccessTokenRequest(); $scope = 'mail.google.com/invalid-scope'; $req->addScope($scope); $exception = new \google\appengine\runtime\ApplicationError($error, "not initialized"); $this->setExpectedException('\\google\\appengine\\api\\app_identity\\AppIdentityException', $expected_response); self::expectGetAccessTokenRequest(array($scope), false, $exception); $result = AppIdentityService::getAccessToken($scope); }