/** * @covers OAuth\OAuth1\Service\AbstractService::requestRequestToken * @covers OAuth\OAuth1\Service\AbstractService::buildAuthorizationHeaderForTokenRequest * @covers OAuth\OAuth1\Service\AbstractService::getBasicAuthorizationHeaderInfo * @covers OAuth\OAuth1\Service\AbstractService::generateNonce * @covers OAuth\OAuth1\Service\AbstractService::getSignatureMethod * @covers OAuth\OAuth1\Service\AbstractService::getVersion * @covers OAuth\OAuth1\Service\AbstractService::getExtraOAuthHeaders * @covers OAuth\OAuth1\Service\AbstractService::parseRequestTokenResponse */ public function testRequestRequestTokenBuildAuthHeaderTokenRequestWithoutParams() { $service = new Mock($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), new Browser(), $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface')); $requestToken = $service->requestRequestToken(); $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $requestToken); $this->assertSame('http://pieterhordijk.com/token', (string) $requestToken->getRequestToken()['uri']); }
/** * @covers OAuth\OAuth1\Service\AbstractService::requestRequestToken * @covers OAuth\OAuth1\Service\AbstractService::buildAuthorizationHeaderForTokenRequest * @covers OAuth\OAuth1\Service\AbstractService::getBasicAuthorizationHeaderInfo * @covers OAuth\OAuth1\Service\AbstractService::generateNonce * @covers OAuth\OAuth1\Service\AbstractService::getSignatureMethod * @covers OAuth\OAuth1\Service\AbstractService::getVersion * @covers OAuth\OAuth1\Service\AbstractService::getExtraOAuthHeaders * @covers OAuth\OAuth1\Service\AbstractService::parseRequestTokenResponse */ public function testRequestRequestTokenBuildAuthHeaderTokenRequestWithoutParams() { $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function ($endpoint, $array, $headers) { \PHPUnit_Framework_Assert::assertSame('http://pieterhordijk.com/token', $endpoint->getAbsoluteUri()); })); $service = new Mock($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $client, $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface')); $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); }