/** * @covers OAuth\OAuth2\Service\Yammer::__construct * @covers OAuth\OAuth2\Service\Yammer::getAccessTokenEndpoint */ public function testGetAccessTokenEndpoint() { $service = new Yammer($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $this->getMock('\\Buzz\\Browser'), $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface')); $this->assertSame('https://www.yammer.com/oauth2/access_token.json', (string) $service->getAccessTokenEndpoint()); }
/** * @covers OAuth\OAuth2\Service\Yammer::__construct * @covers OAuth\OAuth2\Service\Yammer::parseAccessTokenResponse */ public function testParseAccessTokenResponseValidWithRefreshToken() { $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":{"token":"foo", "expires_at":null},"refresh_token":"baz"}')); $service = new Yammer($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $client, $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface')); $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); }