/** * @covers OAuth\OAuth2\Service\Buffer::__construct * @covers OAuth\OAuth2\Service\Buffer::parseAccessTokenResponse * @covers OAuth\OAuth2\Service\Buffer::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 Buffer($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\Buffer::__construct * @covers OAuth\OAuth2\Service\Buffer::getAccessTokenEndpoint */ public function testGetAccessTokenEndpoint() { $service = new Buffer($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $this->getMock('\\Buzz\\Browser'), $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface')); $this->assertSame('https://api.bufferapp.com/1/oauth2/token.json', (string) $service->getAccessTokenEndpoint()); }