public function testGetUrlReturnsEncodedQueryStringParamsAppendedToLocalUrl()
 {
     $redirect = new Http\UserAuthorization($this->stubConsumer, array('foo '=>'bar~'));
     $expected =
         'http://www.example.com/authorize?oauth_token=1234567890&oauth_callback=http%3A%2F%2Fwww.example.com%2Flocal&foo%20=bar~';
     $this->assertEquals($expected, $redirect->getUrl());
 }
Example #2
0
 /**
  * After a Request Token is retrieved, the user may be redirected to the
  * OAuth Provider to authorize the application's access to their
  * protected resources - the redirect URL being provided by this method.
  * Once the user has authorized the application for access, they are
  * redirected back to the application which can now exchange the previous
  * Request Token for a fully authorized Access Token.
  *
  * @param  null|array $customServiceParameters
  * @param  null|Zend\OAuth\Token\Request $token
  * @param  null|Zend\OAuth\HTTP\UserAuthorization $redirect
  * @return string
  */
 public function getRedirectUrl(array $customServiceParameters = null, Token\Request $token = null, Http\UserAuthorization $redirect = null)
 {
     if ($redirect === null) {
         $redirect = new Http\UserAuthorization($this, $customServiceParameters);
     } elseif ($customServiceParameters !== null) {
         $redirect->setParameters($customServiceParameters);
     }
     if ($token !== null) {
         $this->_requestToken = $token;
     }
     return $redirect->getUrl();
 }