Example #1
0
 /**
  * Handles a HTTP request
  *
  * @return void
  */
 public function handleRequest()
 {
     // Create the request very early so the Resource Management has a chance to grab it:
     $this->request = Request::createFromEnvironment();
     $this->response = new Response();
     $this->boot();
     $this->resolveDependencies();
     $this->request->injectSettings($this->settings);
     $this->router->setRoutesConfiguration($this->routesConfiguration);
     $actionRequest = $this->router->route($this->request);
     $this->securityContext->injectRequest($actionRequest);
     $this->dispatcher->dispatch($actionRequest, $this->response);
     $this->response->makeStandardsCompliant($this->request);
     $this->response->send();
     $this->bootstrap->shutdown('Runtime');
     $this->exit->__invoke();
 }
Example #2
0
 /**
  * @test
  */
 public function getBaseUriReturnsThePresetBaseUriIfItHasBeenSet()
 {
     $server = array('HTTP_HOST' => 'dev.blog.rob', 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/foo/bar', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php');
     $settings = array('http' => array('baseUri' => 'http://prod.blog.rob/'));
     $request = new Request(array(), array(), array(), array(), $server);
     $request->injectSettings($settings);
     $this->assertEquals('http://prod.blog.rob/', (string) $request->getBaseUri());
 }