Ejemplo n.º 1
0
 function test_dispatcher_setup()
 {
     $uri = NServer::setUri();
     $dispatcher =& new NDispatcher($uri);
     $dispatcher->setParams($uri);
     $this->assertEquals($dispatcher->controller, "page", "Controller set from URI");
     $this->assertEquals($dispatcher->action, "edit", "Action set from URI");
     $this->assertEquals($dispatcher->parameter, "1", "Parameter set from URI");
     $_SERVER['REQUEST_URI'] = '/bogus/action/999999';
     $_SERVER['PATH_INFO'] = '/bogus/action/999999';
     $uri = NServer::setUri();
     $dispatcher =& new NDispatcher($uri);
     $dispatcher->setParams($uri);
     $this->assertEquals($dispatcher->controller, "bogus", "Bogus Controller allowed by dispatcher");
     $this->assertEquals($dispatcher->action, "action", "Bogus Action allowed by dispatcher");
     $this->assertEquals($dispatcher->parameter, "999999", "Bogus Parameter allowed by dispatcher");
 }
Ejemplo n.º 2
0
<?php

// if (file_exists($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'])) return false;
if (preg_match('/\\.(?:png|jpg|jpeg|gif|css|js)$/', $_SERVER["REQUEST_URI"])) {
    return false;
}
require_once dirname(__FILE__) . '/../vendor/autoload.php';
$dispatcher = new NDispatcher(NServer::setUri());
$dispatcher->dispatch();
unset($dispatcher);