$appDir = '../app'; define('APP_PATH', realpath($appDir)); $vendorDir = '../vendor'; define('VENDOR_PATH', realpath($vendorDir)); $tmpDir = '../tmp'; define('TMP_PATH', realpath($tmpDir)); $jsControllersDir = 'assets/js/controllers'; define('JS_CONTROLLER_PATH', realpath($jsControllersDir)); require_once APP_PATH . '/env.php'; require_once APP_PATH . '/bootstrap.php'; // end: bootstrap the application // get URL for processing $url = isset($_GET['r']) ? trim($_GET['r'], '/') : ''; if (ENVIRONMENT == 'dev') { // In the development environment all errors will be shown RequestHandler::factory($container, $url)->run(); } else { // In the production environment error pages will be shown instead try { RequestHandler::factory($container, $url)->run(); } catch (DBException $ex1) { header($_SERVER["SERVER_PROTOCOL"] . ' 500 Internal server error'); echo $container->getTwig()->render('500.html', array()); } catch (UrlNotFoundException $ex2) { header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); echo $container->getTwig()->render('404.html', array()); } catch (NotFoundException $ex3) { header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); echo $container->getTwig()->render('404.html', array()); } }
public function testRequestHandlerRunController() { $requestHandler = RequestHandler::factory($this->container, '/'); $requestHandler->run(); }