Пример #1
0
 public function testToSetAndGetSomeParam()
 {
     Globals::registre('foo', 'bar');
     $actual = Globals::get('foo');
     $expect = 'bar';
     $this->assertEquals($expect, $actual);
 }
Пример #2
0
 /**
  *   Durante el constructor se registra el directorio
  *   base de la aplicacion, la url base completa del la
  *   aplicacion y la url solicitada, se carga el archivo 
  *   de configuracion y se registra el Error handler de 
  *   bitphp
  */
 public function __construct()
 {
     Globals::registre(['base_path' => realpath(''), 'base_url' => $this->getBaseUrl(), 'request_uri' => $this->getRequestUri(), 'app_path' => realpath('') . '/app']);
     Config::load('app');
     $errorHandler = new Error();
     $errorHandler->registre();
 }
Пример #3
0
 public function __construct()
 {
     Globals::registre('base_path', realpath(''));
     if ($this->runnigInWebServer()) {
         Response::redir('/');
         exit;
     }
 }
Пример #4
0
 protected function setUp()
 {
     \Bitphp\Core\Globals::registre('base_path', '/foo');
     self::$file = array();
     self::$file['params'] = ['foo' => 'abc123', 'bar' => 'zxc456', 'baz' => 'qwe789'];
     self::$file['content'] = 'Something here';
     $hash = md5(json_encode(self::$file['params']));
     self::$file['name'] = '/foo/olimpus/cache/' . $hash . '.lock';
 }
Пример #5
0
 /**
  *   Durante el contructor se obtiene informacion
  *   de la ruta, la ruta en si, el metodo http que
  *   se solicita
  */
 public function __construct()
 {
     parent::__construct();
     $route = Route::parse(Globals::get('request_uri'));
     Globals::registre('uri_params', $route['params']);
     $this->action = $route['action'];
     $this->method = $route['method'];
     $this->routes = array();
     $this->binded = array();
 }
Пример #6
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;
 }
Пример #7
0
 private static function restoreEnvironment()
 {
     Globals::registre(self::$environment_backup);
 }