/**
  * Dispatch
  *
  * This is unfortunately necessary because PHPUnit doesn't set all of the server headers
  * needed by the OAuth2 module.
  *
  * @param string $url
  * @param null $method
  * @param array $params
  * @param bool $isXmlHttpRequest
  */
 public function dispatch($url, $method = null, $params = array(), $isXmlHttpRequest = false)
 {
     $methodOrig = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
     $_SERVER['REQUEST_METHOD'] = $method;
     parent::dispatch($url, $method, $params, $isXmlHttpRequest);
     if ($methodOrig) {
         $_SERVER['REQUEST_METHOD'] = $methodOrig;
     } else {
         unset($_SERVER['REQUEST_METHOD']);
     }
 }