Пример #1
0
 /**
  * @return string
  */
 public function getAuthorizationUri() : string
 {
     $token = $this->service->requestRequestToken();
     $url = $this->service->getAuthorizationUri(['oauth_token' => $token->getRequestToken()]);
     return $url->__toString();
 }
Пример #2
0
 /**
  * @covers OAuth\OAuth1\Service\Twitter::__construct
  * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint
  * @covers OAuth\OAuth1\Service\Twitter::parseRequestTokenResponse
  * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse
  */
 public function testParseRequestTokenResponseValid()
 {
     $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface');
     $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar'));
     $service = new Twitter($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), $client, $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'));
     $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken());
 }