Exemple #1
0
 /**
  * @covers OpCacheGUI\Presentation\Html::__construct
  * @covers OpCacheGUI\Presentation\Html::render
  * @covers OpCacheGUI\Presentation\Html::renderTemplate
  */
 public function testRender()
 {
     $html = new Html(__DIR__ . '/../../Data/templates/', 'skeleton.phtml', $this->getMock('\\OpCacheGUI\\I18n\\Translator'), $this->getMock('\\OpCacheGUI\\Presentation\\UrlRenderer'));
     $this->assertSame('<skeleton>content</skeleton>', $html->render('example.phtml'));
 }
Exemple #2
0
 * Setup the IP whitelist
 */
$whitelist = new Ip([new \OpCacheGUI\Network\Ip\Any(), new \OpCacheGUI\Network\Ip\Localhost(), new \OpCacheGUI\Network\Ip\Single(), new \OpCacheGUI\Network\Ip\Wildcard(), new \OpCacheGUI\Network\Ip\Range(), new \OpCacheGUI\Network\Ip\Cidr()]);
$whitelist->buildWhitelist($login['whitelist']);
/**
 * Setup the authentication object
 */
$user = new User($sessionStorage, $login['username'], $login['password'], $whitelist);
/**
 * Setup URL renderer
 */
$urlRenderer = new Url($uriScheme);
/**
 * Setup the HTML template renderer
 */
$htmlTemplate = new Html(__DIR__ . '/template', 'page.phtml', $translator, $urlRenderer);
/**
 * Setup the JSON template renderer
 */
$jsonTemplate = new Json(__DIR__ . '/template', $translator);
/**
 * 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