Beispiel #1
0
 /**
  * @covers OAuth\OAuth2\Service\Heroku::__construct
  * @covers OAuth\OAuth2\Service\Heroku::getAccessTokenEndpoint
  */
 public function testGetAccessTokenEndpoint()
 {
     $service = new Heroku($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $this->getMock('\\Buzz\\Browser'), $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'));
     $this->assertSame('https://id.heroku.com/oauth/token', (string) $service->getAccessTokenEndpoint());
 }
Beispiel #2
0
 /**
  * @covers OAuth\OAuth2\Service\Heroku::__construct
  * @covers OAuth\OAuth2\Service\Heroku::getExtraApiHeaders
  */
 public function testGetExtraApiHeaders()
 {
     $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
     $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2));
     $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface');
     $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES));
     $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo'));
     $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface');
     $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token));
     $service = new Heroku($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $client, $storage);
     $headers = $service->request('https://pieterhordijk.com/my/awesome/path');
     $this->assertTrue(array_key_exists('Accept', $headers));
     $this->assertSame('application/vnd.heroku+json; version=3', $headers['Accept']);
 }