/** * @covers OAuth\OAuth2\Service\Bitly::__construct * @covers OAuth\OAuth2\Service\Bitly::parseAccessTokenResponse * @covers OAuth\OAuth2\Service\Bitly::requestAccessToken */ public function testParseAccessTokenResponseValid() { $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('access_token=foo')); $service = new Bitly($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $client, $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface')); $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); }
/** * @covers OAuth\OAuth2\Service\Bitly::__construct * @covers OAuth\OAuth2\Service\Bitly::getAccessTokenEndpoint */ public function testGetAccessTokenEndpoint() { $service = new Bitly($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $this->getMock('\\Buzz\\Browser'), $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface')); $this->assertSame('https://api-ssl.bitly.com/oauth/access_token', (string) $service->getAccessTokenEndpoint()); }