Пример #1
0
 public function testOptionalOauthParametersAreNotAutomaticallyAdded()
 {
     // The only required Oauth parameters are the consumer key and secret. That is enough credentials
     // for signing oauth requests.
     $config = array('consumer_key' => 'foo', 'consumer_secret' => 'bar');
     $plugin = new OauthPlugin($config);
     $event = new Event(array('request' => $this->getRequest(), 'timestamp' => self::TIMESTAMP));
     $timestamp = $plugin->getTimestamp($event);
     $request = $event['request'];
     $nonce = $plugin->generateNonce($request);
     $paramsToSign = $plugin->getParamsToSign($request, $timestamp, $nonce);
     $optionalParams = array('callback' => 'oauth_callback', 'token' => 'oauth_token', 'verifier' => 'oauth_verifier', 'token_secret' => 'token_secret');
     foreach ($optionalParams as $optionName => $oauthName) {
         $this->assertArrayNotHasKey($oauthName, $paramsToSign, "Optional Oauth param '{$oauthName}' was not set via config variable '{$optionName}', but it is listed in getParamsToSign().");
     }
 }