public function setup() { $this->stubConsumer = new Test_Consumer_32874(); $this->stubConsumer2 = new Test_Consumer_32874b(); $this->stubHttpUtility = new Test_Http_Utility_32874(); Zend_Oauth::setHttpClient(new Test_Client_32874()); }
public function testGetHttpClientResetsAuthorizationHeader() { $client = new Test_Http_Client_19485876(); $client->setHeaders('Authorization', 'realm="http://www.example.com",oauth_version="1.0"'); Zend_Oauth::setHttpClient($client); $resetClient = Zend_Oauth::getHttpClient(); $this->assertEquals(null, $resetClient->getHeader('Authorization')); }
/** * Gets the Twitter service object for a token * * @param string|Zend_Oauth_Token_Access $token Access token object or access token string * @param null|string $secret Access token secret if token is provided as string * * @return Zend_Service_Twitter */ public static function getService($token, $secret = null) { $options = XenForo_Application::getOptions(); Zend_Oauth::setHttpClient(XenForo_Helper_Http::getClient('https://api.twitter.com/oauth')); if ($token instanceof Zend_Oauth_Token_Access) { $accessToken = $token; } else { $accessToken = new Zend_Oauth_Token_Access(); $accessToken->setToken($token); $accessToken->setTokenSecret($secret); } return new Zend_Service_Twitter(array('accessToken' => $accessToken, 'oauthOptions' => array('consumerKey' => trim($options->twitterAppKey), 'consumerSecret' => trim($options->twitterAppSecret)), 'httpClientOptions' => XenForo_Helper_Http::getExtraHttpClientOptions('https://api.twitter.com/oauth'))); }