예제 #1
0
 /**
  * @covers OAuth\OAuth2\Service\Amazon::__construct
  * @covers OAuth\OAuth2\Service\Amazon::parseAccessTokenResponse
  */
 public function testParseAccessTokenResponseValidWithRefreshToken()
 {
     $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
     $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}'));
     $service = new Amazon($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $client, $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'));
     $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo'));
 }
예제 #2
0
 /**
  * @covers OAuth\OAuth2\Service\Amazon::__construct
  * @covers OAuth\OAuth2\Service\Amazon::getAccessTokenEndpoint
  */
 public function testGetAccessTokenEndpoint()
 {
     $service = new Amazon($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $this->getMock('\\Buzz\\Browser'), $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'));
     $this->assertSame('https://www.amazon.com/ap/oatoken', (string) $service->getAccessTokenEndpoint());
 }