Beispiel #1
0
 /**
  * @covers OpCacheGUI\Presentation\Url::__construct
  * @covers OpCacheGUI\Presentation\Url::get
  * @covers OpCacheGUI\Presentation\Url::getQueryStringUrl
  */
 public function testGetQueryStringUrlOther()
 {
     $url = new Url(Router::QUERY_STRING);
     $this->assertSame('?other', $url->get('other'));
 }
Beispiel #2
0
/**
 * Setup the request object
 */
$request = new Request($_GET, $_POST, $_SERVER);
/**
 * Setup the router
 */
$routeFactory = new RouteFactory();
$router = new Router($request, $routeFactory, $uriScheme);
/**
 * Load public routes
 */
require_once __DIR__ . '/public-routes.php';
/**
 * Load the routes
 */
if (!extension_loaded('Zend OPcache') || opcache_get_status() === false) {
    if (!in_array($router->getIdentifier(), ['error', 'mainjs', 'maincss', 'fontawesome-webfont_eot', 'fontawesome-webfont_woff', 'fontawesome-webfont_ttf', 'fontawesome-webfont_svg'], true)) {
        header('Location: ' . $urlRenderer->get('error'));
        exit;
    }
    $router->get('error', function () use($htmlTemplate) {
        return $htmlTemplate->render('error.phtml', ['login' => true, 'title' => 'Error', 'type' => !extension_loaded('Zend OPcache') ? 'installed' : 'enabled']);
    });
} else {
    require_once __DIR__ . '/routes.php';
}
/**
 * Dispatch the request
 */
echo $router->run();