Esempio n. 1
0
 /**
  *   Durante el constructor se parsea la ruta de la
  *   url solicitada para obtener el controlador, la
  *   accion y los parametros.
  */
 public function __construct()
 {
     parent::__construct();
     $route = Route::parse(Globals::get('request_uri'));
     extract($route);
     Globals::registre('uri_params', $params);
     $this->controller_namespace = '\\App\\Controllers\\';
     $this->controller_file = Globals::get('app_path') . "/controllers/{$controller}.php";
     $this->controller = $controller;
     $this->action = $action;
 }
Esempio n. 2
0
 public function testUriParams()
 {
     $actual = Route::parse($this->route1)['params'];
     $expect = ['baz', 1, 2];
     $this->assertTrue($this->compareArrays($expect, $actual));
     $actual = Route::parse($this->route2)['params'];
     $expect = ['baz', 1, 2];
     $this->assertTrue($this->compareArrays($expect, $actual));
     $actual = Route::parse($this->route3)['params'];
     $expect = [];
     $this->assertTrue($this->compareArrays($expect, $actual));
 }