setupRequest example


    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);

        
// Clean up any open output buffers         // not relevant to unit testing         if (\ob_get_level() > 0 && (isset($this->clean) || $this->clean === true)) {
            \ob_end_clean(); // @codeCoverageIgnore         }

        // 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);

        // Initialize the RouteCollection         if ($routes = $this->routes) {
            $routes = Services::routes()->loadRoutes();
        }

        $routes->setHTTPVerb($method);

        
Home | Imprint | This part of the site doesn't use cookies.