public function testGetAuthURL()
 {
     $client = new Client(array('client_id' => self::CLIENT_ID, 'client_secret' => self::CLIENT_SECRET, 'scope' => "user_read_write"));
     $_SERVER['HTTP_HOST'] = 'www.test.com';
     $_SERVER['REQUEST_URI'] = '/login.php';
     $login_url = parse_url($client->get_auth_url());
     $this->assertEquals($login_url['host'], $client->options['dashboard_host']);
     $this->assertEquals($login_url['path'], '/auth');
     $expected_login_params = array('response_type' => "code", 'client_id' => self::CLIENT_ID, 'redirect_uri' => "http://www.test.com/login.php", 'scope' => "user_read_write");
     $query_map = array();
     parse_str($login_url['query'], $query_map);
     $this->assertEquals($expected_login_params, $query_map);
 }
 /**
  * @return a url to redirect to request an authorization code, used later for requesting a token
  */
 public static function requestAuthorizationCode($client_id, $client_secret, $scope, $redirect_uri = NULL)
 {
     //create a new client without having a token
     $client = new Client(array('client_id' => $client_id, 'client_secret' => $client_secret, 'scope' => $scope, 'redirect_uri' => $redirect_uri));
     return $client->get_auth_url();
 }