public function call(string
$method, string
$path, ?array
$params = null
) { // Simulate having a blank session
$_SESSION =
[];
$_SERVER['REQUEST_METHOD'
] =
$method;
$request =
$this->
setupRequest($method,
$path);
$request =
$this->
setupHeaders($request);
$request =
$this->
populateGlobals($method,
$request,
$params);
$request =
$this->
setRequestBody($request,
$params);
// Initialize the RouteCollection
if (!
$routes =
$this->routes
) { $routes = Services::
routes()->
loadRoutes();
} $routes->
setHTTPVerb($method);
// Make sure any other classes that might call the request
// instance get the right one.
Services::
injectMock('request',
$request);