OAuthTestMocksOAuth2ServiceMock

The Gravity Forms Salesforce Add-On OAuthTest Mocks OAuth2 Service Mock class.

Defined (1)

The class is defined in the following location(s).

/lib/PHPoAuthLib/tests/Mocks/OAuth2/Service/Mock.php  
  1. class Mock extends AbstractService 
  2. const SCOPE_MOCK = 'mock'; 
  3. const SCOPE_MOCK_2 = 'mock2'; 
  4.  
  5. private $authorizationMethod = null; 
  6.  
  7. public function getAuthorizationEndpoint() 
  8. return new Uri('http://pieterhordijk.com/auth'); 
  9.  
  10. public function getAccessTokenEndpoint() 
  11. return new Uri('http://pieterhordijk.com/access'); 
  12.  
  13. protected function parseAccessTokenResponse($responseBody) 
  14. return new StdOAuth2Token(); 
  15.  
  16. // this allows us to set different auth methods for tests 
  17. public function setAuthorizationMethod($method) 
  18. $this->authorizationMethod = $method; 
  19.  
  20. /** 
  21. * Returns a class constant from ServiceInterface defining the authorization method used for the API 
  22. * Header is the sane default. 
  23. * @return int 
  24. */ 
  25. protected function getAuthorizationMethod() 
  26. switch($this->authorizationMethod) { 
  27. case 'querystring': 
  28. return static::AUTHORIZATION_METHOD_QUERY_STRING; 
  29.  
  30. case 'querystring2': 
  31. return static::AUTHORIZATION_METHOD_QUERY_STRING_V2; 
  32.  
  33. case 'bearer': 
  34. return static::AUTHORIZATION_METHOD_HEADER_BEARER; 
  35.  
  36. return parent::getAuthorizationMethod();