Example #1
0
 public function testProcessRouterArray()
 {
     $_SERVER['REQUEST_URI'] = '/test/55';
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $t = false;
     $routes = array('/test/{id}' => array('type' => 'get', 'action' => function () use(&$t) {
         $t = true;
         return false;
     }, 'where' => array('id' => 'integer_positive')));
     Router::filter('/test/{*}')->to($routes)->process();
     $this->assertTrue($t);
     $t = false;
     $routes = array('/test/{*}' => array('type' => 'filter', 'action' => $routes));
     Router::processRouterArray($routes);
     $this->assertTrue($t);
 }