/** * @covers OAuth\OAuth2\Service\Mailchimp::__construct * @covers OAuth\OAuth2\Service\Mailchimp::parseAccessTokenResponse */ public function testParseAccessTokenResponseValid() { $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); $client->expects($this->at(0))->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); $client->expects($this->at(1))->method('retrieveResponse')->will($this->returnValue('{"dc": "us7"}')); $service = new Mailchimp($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\Mailchimp::__construct * @covers OAuth\OAuth2\Service\Mailchimp::getAccessTokenEndpoint */ public function testGetAccessTokenEndpoint() { $service = new Mailchimp($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $this->getMock('\\Buzz\\Browser'), $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface')); $this->assertSame('https://login.mailchimp.com/oauth2/token', (string) $service->getAccessTokenEndpoint()); }