@@ -1,25 +1,25 @@ |
||
| 1 | 1 | <?php |
| 2 | - defined('ROOT_PATH') || exit('Access denied'); |
|
| 2 | + defined('ROOT_PATH') || exit('Access denied'); |
|
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * |
|
| 6 | - */ |
|
| 7 | - class Home extends Controller { |
|
| 4 | + /** |
|
| 5 | + * |
|
| 6 | + */ |
|
| 7 | + class Home extends Controller { |
|
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * the class constructor |
|
| 11 | - */ |
|
| 12 | - public function __construct() { |
|
| 13 | - parent::__construct(); |
|
| 14 | - } |
|
| 9 | + /** |
|
| 10 | + * the class constructor |
|
| 11 | + */ |
|
| 12 | + public function __construct() { |
|
| 13 | + parent::__construct(); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * The default method |
|
| 18 | - * @return null |
|
| 19 | - */ |
|
| 20 | - public function index() { |
|
| 21 | - Loader::library('Assets'); |
|
| 22 | - Loader::library('Html'); |
|
| 23 | - $this->response->render('home'); |
|
| 24 | - } |
|
| 25 | - } |
|
| 16 | + /** |
|
| 17 | + * The default method |
|
| 18 | + * @return null |
|
| 19 | + */ |
|
| 20 | + public function index() { |
|
| 21 | + Loader::library('Assets'); |
|
| 22 | + Loader::library('Html'); |
|
| 23 | + $this->response->render('home'); |
|
| 24 | + } |
|
| 25 | + } |
|
@@ -1,28 +1,28 @@ |
||
| 1 | 1 | <?php |
| 2 | - class DBSessionModel extends DBSessionHandlerModel{ |
|
| 2 | + class DBSessionModel extends DBSessionHandlerModel{ |
|
| 3 | 3 | |
| 4 | - protected $_table = 'ses'; |
|
| 5 | - protected $primary_key = 's_id'; |
|
| 4 | + protected $_table = 'ses'; |
|
| 5 | + protected $primary_key = 's_id'; |
|
| 6 | 6 | |
| 7 | - protected $sessionTableColumns = array( |
|
| 8 | - 'sid' => 's_id', //VARCHAR(255) |
|
| 9 | - 'sdata' => 's_data', //TEXT |
|
| 10 | - 'stime' => 's_time', //unix timestamp (INT|BIGINT) |
|
| 11 | - 'shost' => 's_host', //VARCHAR(255) |
|
| 12 | - 'sip' => 's_ip', //VARCHAR(255) |
|
| 13 | - 'sbrowser' => 's_browser', //VARCHAR(255) |
|
| 14 | - 'skey' => 'test_id' //VARCHAR(255) |
|
| 15 | - ); |
|
| 7 | + protected $sessionTableColumns = array( |
|
| 8 | + 'sid' => 's_id', //VARCHAR(255) |
|
| 9 | + 'sdata' => 's_data', //TEXT |
|
| 10 | + 'stime' => 's_time', //unix timestamp (INT|BIGINT) |
|
| 11 | + 'shost' => 's_host', //VARCHAR(255) |
|
| 12 | + 'sip' => 's_ip', //VARCHAR(255) |
|
| 13 | + 'sbrowser' => 's_browser', //VARCHAR(255) |
|
| 14 | + 'skey' => 'test_id' //VARCHAR(255) |
|
| 15 | + ); |
|
| 16 | 16 | |
| 17 | - public function deleteByTime($time){ |
|
| 18 | - $this->getQueryBuilder()->from($this->_table) |
|
| 19 | - ->where('s_time', '<', $time); |
|
| 20 | - $this->_database->delete(); |
|
| 21 | - } |
|
| 17 | + public function deleteByTime($time){ |
|
| 18 | + $this->getQueryBuilder()->from($this->_table) |
|
| 19 | + ->where('s_time', '<', $time); |
|
| 20 | + $this->_database->delete(); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | - public function getKeyValue(){ |
|
| 25 | - $user_id = 0; |
|
| 26 | - return $user_id; |
|
| 27 | - } |
|
| 28 | - } |
|
| 29 | 24 | \ No newline at end of file |
| 25 | + public function getKeyValue(){ |
|
| 26 | + $user_id = 0; |
|
| 27 | + return $user_id; |
|
| 28 | + } |
|
| 29 | + } |
|
| 30 | 30 | \ No newline at end of file |
@@ -1,292 +1,292 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * TNH Framework |
|
| 4 | - * |
|
| 5 | - * A simple PHP framework using HMVC architecture |
|
| 6 | - * |
|
| 7 | - * This content is released under the GNU GPL License (GPL) |
|
| 8 | - * |
|
| 9 | - * Copyright (C) 2017 Tony NGUEREZA |
|
| 10 | - * |
|
| 11 | - * This program is free software; you can redistribute it and/or |
|
| 12 | - * modify it under the terms of the GNU General Public License |
|
| 13 | - * as published by the Free Software Foundation; either version 3 |
|
| 14 | - * of the License, or (at your option) any later version. |
|
| 15 | - * |
|
| 16 | - * This program is distributed in the hope that it will be useful, |
|
| 17 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 18 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 19 | - * GNU General Public License for more details. |
|
| 20 | - * |
|
| 21 | - * You should have received a copy of the GNU General Public License |
|
| 22 | - * along with this program; if not, write to the Free Software |
|
| 23 | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
| 24 | - */ |
|
| 2 | + /** |
|
| 3 | + * TNH Framework |
|
| 4 | + * |
|
| 5 | + * A simple PHP framework using HMVC architecture |
|
| 6 | + * |
|
| 7 | + * This content is released under the GNU GPL License (GPL) |
|
| 8 | + * |
|
| 9 | + * Copyright (C) 2017 Tony NGUEREZA |
|
| 10 | + * |
|
| 11 | + * This program is free software; you can redistribute it and/or |
|
| 12 | + * modify it under the terms of the GNU General Public License |
|
| 13 | + * as published by the Free Software Foundation; either version 3 |
|
| 14 | + * of the License, or (at your option) any later version. |
|
| 15 | + * |
|
| 16 | + * This program is distributed in the hope that it will be useful, |
|
| 17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 19 | + * GNU General Public License for more details. |
|
| 20 | + * |
|
| 21 | + * You should have received a copy of the GNU General Public License |
|
| 22 | + * along with this program; if not, write to the Free Software |
|
| 23 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
| 24 | + */ |
|
| 25 | 25 | |
| 26 | - error_reporting(E_ALL | E_STRICT); |
|
| 27 | - ini_set('display_errors', 1); |
|
| 26 | + error_reporting(E_ALL | E_STRICT); |
|
| 27 | + ini_set('display_errors', 1); |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * the directory separator, under windows it is \ and unix, linux / |
|
| 31 | - */ |
|
| 32 | - define('DS', DIRECTORY_SEPARATOR); |
|
| 29 | + /** |
|
| 30 | + * the directory separator, under windows it is \ and unix, linux / |
|
| 31 | + */ |
|
| 32 | + define('DS', DIRECTORY_SEPARATOR); |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * The root directory of the application. |
|
| 36 | - * |
|
| 37 | - * you can place this directory outside of your web directory, for example "/home/your_app", etc. |
|
| 38 | - */ |
|
| 39 | - define('ROOT_PATH', dirname(realpath(__FILE__)) . DS . '..' . DS); |
|
| 34 | + /** |
|
| 35 | + * The root directory of the application. |
|
| 36 | + * |
|
| 37 | + * you can place this directory outside of your web directory, for example "/home/your_app", etc. |
|
| 38 | + */ |
|
| 39 | + define('ROOT_PATH', dirname(realpath(__FILE__)) . DS . '..' . DS); |
|
| 40 | 40 | |
| 41 | - //tests dir path |
|
| 42 | - define('TESTS_PATH', dirname(realpath(__FILE__)) . DS); |
|
| 41 | + //tests dir path |
|
| 42 | + define('TESTS_PATH', dirname(realpath(__FILE__)) . DS); |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * The path to the directory. |
|
| 47 | - * |
|
| 48 | - * That contains your static files (javascript, css, images, etc.) |
|
| 49 | - * Note: the path must be relative to the file index.php (the front-end controller). |
|
| 50 | - */ |
|
| 51 | - define('ASSETS_PATH', 'assets/'); |
|
| 45 | + /** |
|
| 46 | + * The path to the directory. |
|
| 47 | + * |
|
| 48 | + * That contains your static files (javascript, css, images, etc.) |
|
| 49 | + * Note: the path must be relative to the file index.php (the front-end controller). |
|
| 50 | + */ |
|
| 51 | + define('ASSETS_PATH', 'assets/'); |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * The path to the directory of your cache files. |
|
| 55 | - * |
|
| 56 | - * This feature is available currently for database and views. |
|
| 57 | - */ |
|
| 58 | - define('CACHE_PATH', ROOT_PATH . 'cache' . DS); |
|
| 53 | + /** |
|
| 54 | + * The path to the directory of your cache files. |
|
| 55 | + * |
|
| 56 | + * This feature is available currently for database and views. |
|
| 57 | + */ |
|
| 58 | + define('CACHE_PATH', ROOT_PATH . 'cache' . DS); |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Custom application path for tests |
|
| 62 | - */ |
|
| 63 | - define('APPS_PATH', TESTS_PATH .'hmvc' . DS); |
|
| 60 | + /** |
|
| 61 | + * Custom application path for tests |
|
| 62 | + */ |
|
| 63 | + define('APPS_PATH', TESTS_PATH .'hmvc' . DS); |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * The path to the controller directory of your application. |
|
| 67 | - * |
|
| 68 | - * If you already know the MVC architecture you know what a controller means; |
|
| 69 | - * it is he who makes the business logic of your application in general. |
|
| 70 | - */ |
|
| 71 | - define('APPS_CONTROLLER_PATH', APPS_PATH . 'controllers' . DS); |
|
| 65 | + /** |
|
| 66 | + * The path to the controller directory of your application. |
|
| 67 | + * |
|
| 68 | + * If you already know the MVC architecture you know what a controller means; |
|
| 69 | + * it is he who makes the business logic of your application in general. |
|
| 70 | + */ |
|
| 71 | + define('APPS_CONTROLLER_PATH', APPS_PATH . 'controllers' . DS); |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * The path to the directory of your model classes of your application. |
|
| 75 | - * |
|
| 76 | - * If you already know the MVC architecture you know what a model means; |
|
| 77 | - * it's the one who interacts with the database, in one word persistent data from your application. |
|
| 78 | - */ |
|
| 79 | - define('APPS_MODEL_PATH', APPS_PATH . 'models' . DS); |
|
| 73 | + /** |
|
| 74 | + * The path to the directory of your model classes of your application. |
|
| 75 | + * |
|
| 76 | + * If you already know the MVC architecture you know what a model means; |
|
| 77 | + * it's the one who interacts with the database, in one word persistent data from your application. |
|
| 78 | + */ |
|
| 79 | + define('APPS_MODEL_PATH', APPS_PATH . 'models' . DS); |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * The path to the directory of your views. |
|
| 83 | - * |
|
| 84 | - * If you already know the MVC architecture you know what a view means, |
|
| 85 | - * a view is just a user interface (html page, form, etc.) that is to say |
|
| 86 | - * everything displayed in the browser interface, etc. |
|
| 87 | - */ |
|
| 88 | - define('APPS_VIEWS_PATH', APPS_PATH . 'views' . DS); |
|
| 81 | + /** |
|
| 82 | + * The path to the directory of your views. |
|
| 83 | + * |
|
| 84 | + * If you already know the MVC architecture you know what a view means, |
|
| 85 | + * a view is just a user interface (html page, form, etc.) that is to say |
|
| 86 | + * everything displayed in the browser interface, etc. |
|
| 87 | + */ |
|
| 88 | + define('APPS_VIEWS_PATH', APPS_PATH . 'views' . DS); |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * The path to the configuration directory. |
|
| 92 | - * |
|
| 93 | - * That contains most of the configuration files for your |
|
| 94 | - * application (database, class loading file, functions, etc.) |
|
| 95 | - */ |
|
| 96 | - define('CONFIG_PATH', ROOT_PATH . 'config' . DS); |
|
| 90 | + /** |
|
| 91 | + * The path to the configuration directory. |
|
| 92 | + * |
|
| 93 | + * That contains most of the configuration files for your |
|
| 94 | + * application (database, class loading file, functions, etc.) |
|
| 95 | + */ |
|
| 96 | + define('CONFIG_PATH', ROOT_PATH . 'config' . DS); |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * The core directory |
|
| 100 | - * |
|
| 101 | - * It is recommended to put this folder out of the web directory of your server and |
|
| 102 | - * you should not change its content because in case of update you could lose the modified files. |
|
| 103 | - */ |
|
| 104 | - define('CORE_PATH', ROOT_PATH . 'core' . DS); |
|
| 98 | + /** |
|
| 99 | + * The core directory |
|
| 100 | + * |
|
| 101 | + * It is recommended to put this folder out of the web directory of your server and |
|
| 102 | + * you should not change its content because in case of update you could lose the modified files. |
|
| 103 | + */ |
|
| 104 | + define('CORE_PATH', ROOT_PATH . 'core' . DS); |
|
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * The path to the directory of core classes that used by the system. |
|
| 108 | - * |
|
| 109 | - * It contains PHP classes that are used by the framework internally. |
|
| 110 | - */ |
|
| 111 | - define('CORE_CLASSES_PATH', CORE_PATH . 'classes' . DS); |
|
| 106 | + /** |
|
| 107 | + * The path to the directory of core classes that used by the system. |
|
| 108 | + * |
|
| 109 | + * It contains PHP classes that are used by the framework internally. |
|
| 110 | + */ |
|
| 111 | + define('CORE_CLASSES_PATH', CORE_PATH . 'classes' . DS); |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * The path to the directory of core classes for the cache used by the system. |
|
| 115 | - * |
|
| 116 | - * It contains PHP classes for the cache drivers. |
|
| 117 | - */ |
|
| 118 | - define('CORE_CLASSES_CACHE_PATH', CORE_CLASSES_PATH . 'cache' . DS); |
|
| 113 | + /** |
|
| 114 | + * The path to the directory of core classes for the cache used by the system. |
|
| 115 | + * |
|
| 116 | + * It contains PHP classes for the cache drivers. |
|
| 117 | + */ |
|
| 118 | + define('CORE_CLASSES_CACHE_PATH', CORE_CLASSES_PATH . 'cache' . DS); |
|
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | - * The path to the directory of core classes for the database used by the system. |
|
| 122 | - * |
|
| 123 | - * It contains PHP classes for the database library, drivers, etc. |
|
| 124 | - */ |
|
| 125 | - define('CORE_CLASSES_DATABASE_PATH', CORE_CLASSES_PATH . 'database' . DS); |
|
| 121 | + * The path to the directory of core classes for the database used by the system. |
|
| 122 | + * |
|
| 123 | + * It contains PHP classes for the database library, drivers, etc. |
|
| 124 | + */ |
|
| 125 | + define('CORE_CLASSES_DATABASE_PATH', CORE_CLASSES_PATH . 'database' . DS); |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * The path to the directory of core classes for the model used by the system. |
|
| 129 | - * |
|
| 130 | - * It contains PHP classes for the models. |
|
| 131 | - */ |
|
| 132 | - define('CORE_CLASSES_MODEL_PATH', CORE_CLASSES_PATH . 'model' . DS); |
|
| 127 | + /** |
|
| 128 | + * The path to the directory of core classes for the model used by the system. |
|
| 129 | + * |
|
| 130 | + * It contains PHP classes for the models. |
|
| 131 | + */ |
|
| 132 | + define('CORE_CLASSES_MODEL_PATH', CORE_CLASSES_PATH . 'model' . DS); |
|
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * The path to the directory of functions or helper systems. |
|
| 136 | - * |
|
| 137 | - * It contains PHP functions that perform a particular task: character string processing, URL, etc. |
|
| 138 | - */ |
|
| 139 | - define('CORE_FUNCTIONS_PATH', CORE_PATH . 'functions' . DS); |
|
| 134 | + /** |
|
| 135 | + * The path to the directory of functions or helper systems. |
|
| 136 | + * |
|
| 137 | + * It contains PHP functions that perform a particular task: character string processing, URL, etc. |
|
| 138 | + */ |
|
| 139 | + define('CORE_FUNCTIONS_PATH', CORE_PATH . 'functions' . DS); |
|
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * The path to the core directory of languages files. |
|
| 143 | - * |
|
| 144 | - */ |
|
| 145 | - define('CORE_LANG_PATH', CORE_PATH . 'lang' . DS); |
|
| 141 | + /** |
|
| 142 | + * The path to the core directory of languages files. |
|
| 143 | + * |
|
| 144 | + */ |
|
| 145 | + define('CORE_LANG_PATH', CORE_PATH . 'lang' . DS); |
|
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * The path to the system library directory. |
|
| 149 | - * |
|
| 150 | - * Which contains the libraries most often used in your web application, as for the |
|
| 151 | - * core directory it is advisable to put it out of the root directory of your application. |
|
| 152 | - */ |
|
| 153 | - define('CORE_LIBRARY_PATH', CORE_PATH . 'libraries' . DS); |
|
| 147 | + /** |
|
| 148 | + * The path to the system library directory. |
|
| 149 | + * |
|
| 150 | + * Which contains the libraries most often used in your web application, as for the |
|
| 151 | + * core directory it is advisable to put it out of the root directory of your application. |
|
| 152 | + */ |
|
| 153 | + define('CORE_LIBRARY_PATH', CORE_PATH . 'libraries' . DS); |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * The path to the system view directory. |
|
| 157 | - * |
|
| 158 | - * That contains the views used for the system, such as error messages, and so on. |
|
| 159 | - */ |
|
| 160 | - define('CORE_VIEWS_PATH', CORE_PATH . 'views' . DS); |
|
| 155 | + /** |
|
| 156 | + * The path to the system view directory. |
|
| 157 | + * |
|
| 158 | + * That contains the views used for the system, such as error messages, and so on. |
|
| 159 | + */ |
|
| 160 | + define('CORE_VIEWS_PATH', CORE_PATH . 'views' . DS); |
|
| 161 | 161 | |
| 162 | - /** |
|
| 163 | - * The path to the directory of your PHP personal functions or helper. |
|
| 164 | - * |
|
| 165 | - * It contains your PHP functions that perform a particular task: utilities, etc. |
|
| 166 | - * Note: Do not put your personal functions or helpers in the system functions directory, |
|
| 167 | - * because if you update the system you may lose them. |
|
| 168 | - */ |
|
| 169 | - define('FUNCTIONS_PATH', ROOT_PATH . 'functions' . DS); |
|
| 162 | + /** |
|
| 163 | + * The path to the directory of your PHP personal functions or helper. |
|
| 164 | + * |
|
| 165 | + * It contains your PHP functions that perform a particular task: utilities, etc. |
|
| 166 | + * Note: Do not put your personal functions or helpers in the system functions directory, |
|
| 167 | + * because if you update the system you may lose them. |
|
| 168 | + */ |
|
| 169 | + define('FUNCTIONS_PATH', ROOT_PATH . 'functions' . DS); |
|
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * The path to the app directory of personal language. |
|
| 173 | - * |
|
| 174 | - * This feature is not yet available. |
|
| 175 | - * You can help us do this if you are nice or wish to see the developed framework. |
|
| 176 | - */ |
|
| 177 | - define('APP_LANG_PATH', ROOT_PATH . 'lang' . DS); |
|
| 171 | + /** |
|
| 172 | + * The path to the app directory of personal language. |
|
| 173 | + * |
|
| 174 | + * This feature is not yet available. |
|
| 175 | + * You can help us do this if you are nice or wish to see the developed framework. |
|
| 176 | + */ |
|
| 177 | + define('APP_LANG_PATH', ROOT_PATH . 'lang' . DS); |
|
| 178 | 178 | |
| 179 | - /** |
|
| 180 | - * The path to the directory of your personal libraries |
|
| 181 | - * |
|
| 182 | - * It contains your PHP classes, package, etc. |
|
| 183 | - * Note: you should not put your personal libraries in the system library directory, |
|
| 184 | - * because it is recalled in case of updating the system you might have surprises. |
|
| 185 | - */ |
|
| 186 | - define('LIBRARY_PATH', ROOT_PATH . 'libraries' . DS); |
|
| 179 | + /** |
|
| 180 | + * The path to the directory of your personal libraries |
|
| 181 | + * |
|
| 182 | + * It contains your PHP classes, package, etc. |
|
| 183 | + * Note: you should not put your personal libraries in the system library directory, |
|
| 184 | + * because it is recalled in case of updating the system you might have surprises. |
|
| 185 | + */ |
|
| 186 | + define('LIBRARY_PATH', ROOT_PATH . 'libraries' . DS); |
|
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * The path to the directory that contains the log files. |
|
| 190 | - * |
|
| 191 | - * Note: This directory must be available in writing and if possible must have as owner the user who launches your web server, |
|
| 192 | - * under unix or linux most often with the apache web server it is "www-data" or "httpd" even "nobody" for more |
|
| 193 | - * details see the documentation of your web server. |
|
| 194 | - * Example for Unix or linux with apache web server: |
|
| 195 | - * # chmod -R 700 /path/to/your/logs/directory/ |
|
| 196 | - * # chown -R www-data:www-data /path/to/your/logs/directory/ |
|
| 197 | - */ |
|
| 198 | - define('LOGS_PATH', ROOT_PATH . 'logs' . DS); |
|
| 188 | + /** |
|
| 189 | + * The path to the directory that contains the log files. |
|
| 190 | + * |
|
| 191 | + * Note: This directory must be available in writing and if possible must have as owner the user who launches your web server, |
|
| 192 | + * under unix or linux most often with the apache web server it is "www-data" or "httpd" even "nobody" for more |
|
| 193 | + * details see the documentation of your web server. |
|
| 194 | + * Example for Unix or linux with apache web server: |
|
| 195 | + * # chmod -R 700 /path/to/your/logs/directory/ |
|
| 196 | + * # chown -R www-data:www-data /path/to/your/logs/directory/ |
|
| 197 | + */ |
|
| 198 | + define('LOGS_PATH', ROOT_PATH . 'logs' . DS); |
|
| 199 | 199 | |
| 200 | - /** |
|
| 201 | - * The path to the modules directory. |
|
| 202 | - * |
|
| 203 | - * It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, |
|
| 204 | - * in HMVC architecture (hierichical, controllers, models, views). |
|
| 205 | - */ |
|
| 206 | - define('MODULE_PATH', dirname(realpath(__FILE__)) . DS .'hmvc' . DS . 'modules' . DS); |
|
| 200 | + /** |
|
| 201 | + * The path to the modules directory. |
|
| 202 | + * |
|
| 203 | + * It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, |
|
| 204 | + * in HMVC architecture (hierichical, controllers, models, views). |
|
| 205 | + */ |
|
| 206 | + define('MODULE_PATH', dirname(realpath(__FILE__)) . DS .'hmvc' . DS . 'modules' . DS); |
|
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * The path to the directory of sources external to your application. |
|
| 210 | - * |
|
| 211 | - * If you have already used "composer" you know what that means. |
|
| 212 | - */ |
|
| 213 | - define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS); |
|
| 208 | + /** |
|
| 209 | + * The path to the directory of sources external to your application. |
|
| 210 | + * |
|
| 211 | + * If you have already used "composer" you know what that means. |
|
| 212 | + */ |
|
| 213 | + define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS); |
|
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * The front controller of your application. |
|
| 217 | - * |
|
| 218 | - * "index.php" it is through this file that all the requests come, there is a possibility to hidden it in the url of |
|
| 219 | - * your application by using the rewrite module URL of your web server . |
|
| 220 | - * For example, under apache web server, there is a configuration example file that is located at the root |
|
| 221 | - * of your framework folder : "htaccess.txt" rename it to ".htaccess". |
|
| 222 | - */ |
|
| 223 | - define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
|
| 215 | + /** |
|
| 216 | + * The front controller of your application. |
|
| 217 | + * |
|
| 218 | + * "index.php" it is through this file that all the requests come, there is a possibility to hidden it in the url of |
|
| 219 | + * your application by using the rewrite module URL of your web server . |
|
| 220 | + * For example, under apache web server, there is a configuration example file that is located at the root |
|
| 221 | + * of your framework folder : "htaccess.txt" rename it to ".htaccess". |
|
| 222 | + */ |
|
| 223 | + define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
|
| 224 | 224 | |
| 225 | - /** |
|
| 226 | - * Check if user run the application under CLI |
|
| 227 | - */ |
|
| 228 | - define('IS_CLI', stripos('cli', php_sapi_name()) !== false); |
|
| 225 | + /** |
|
| 226 | + * Check if user run the application under CLI |
|
| 227 | + */ |
|
| 228 | + define('IS_CLI', stripos('cli', php_sapi_name()) !== false); |
|
| 229 | 229 | |
| 230 | - /** |
|
| 231 | - * The environment of your application (production, test, development). |
|
| 232 | - * |
|
| 233 | - * if your application is still in development you use the value "development" |
|
| 234 | - * so you will have the display of the error messages, etc. |
|
| 235 | - * Once you finish the development of your application that is to put it online |
|
| 236 | - * you change this value to "production" or "testing", in this case there will be deactivation of error messages, |
|
| 237 | - * the loading of the system, will be fast. |
|
| 238 | - */ |
|
| 239 | - define('ENVIRONMENT', 'testing'); |
|
| 230 | + /** |
|
| 231 | + * The environment of your application (production, test, development). |
|
| 232 | + * |
|
| 233 | + * if your application is still in development you use the value "development" |
|
| 234 | + * so you will have the display of the error messages, etc. |
|
| 235 | + * Once you finish the development of your application that is to put it online |
|
| 236 | + * you change this value to "production" or "testing", in this case there will be deactivation of error messages, |
|
| 237 | + * the loading of the system, will be fast. |
|
| 238 | + */ |
|
| 239 | + define('ENVIRONMENT', 'testing'); |
|
| 240 | 240 | |
| 241 | 241 | |
| 242 | - //Fix to allow test as if application is running in CLI mode $_SESSION global variable is not available |
|
| 243 | - $_SESSION = array(); |
|
| 242 | + //Fix to allow test as if application is running in CLI mode $_SESSION global variable is not available |
|
| 243 | + $_SESSION = array(); |
|
| 244 | 244 | |
| 245 | - if(! isset($_SERVER['REMOTE_ADDR'])){ |
|
| 246 | - $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; |
|
| 247 | - } |
|
| 245 | + if(! isset($_SERVER['REMOTE_ADDR'])){ |
|
| 246 | + $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - //check for composer autoload file if exists include it |
|
| 250 | - if (file_exists(VENDOR_PATH . 'autoload.php')){ |
|
| 251 | - require_once VENDOR_PATH . 'autoload.php'; |
|
| 249 | + //check for composer autoload file if exists include it |
|
| 250 | + if (file_exists(VENDOR_PATH . 'autoload.php')){ |
|
| 251 | + require_once VENDOR_PATH . 'autoload.php'; |
|
| 252 | 252 | |
| 253 | - //define the class alias for vstream |
|
| 254 | - class_alias('org\bovigo\vfs\vfsStream', 'vfsStream'); |
|
| 255 | - class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory'); |
|
| 256 | - class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper'); |
|
| 253 | + //define the class alias for vstream |
|
| 254 | + class_alias('org\bovigo\vfs\vfsStream', 'vfsStream'); |
|
| 255 | + class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory'); |
|
| 256 | + class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper'); |
|
| 257 | 257 | |
| 258 | - } |
|
| 258 | + } |
|
| 259 | 259 | |
| 260 | - //require autoloader for test |
|
| 261 | - require_once 'include/autoloader.php'; |
|
| 260 | + //require autoloader for test |
|
| 261 | + require_once 'include/autoloader.php'; |
|
| 262 | 262 | |
| 263 | 263 | |
| 264 | 264 | |
| 265 | - //grap from core/common.php functions and mock some functions for tests |
|
| 266 | - require_once 'include/common.php'; |
|
| 265 | + //grap from core/common.php functions and mock some functions for tests |
|
| 266 | + require_once 'include/common.php'; |
|
| 267 | 267 | |
| 268 | - //Some utilities functions, classes, etc. |
|
| 269 | - require_once 'include/testsUtil.php'; |
|
| 268 | + //Some utilities functions, classes, etc. |
|
| 269 | + require_once 'include/testsUtil.php'; |
|
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * Setting of the PHP error message handling function |
|
| 273 | - */ |
|
| 274 | - set_error_handler('php_error_handler'); |
|
| 271 | + /** |
|
| 272 | + * Setting of the PHP error message handling function |
|
| 273 | + */ |
|
| 274 | + set_error_handler('php_error_handler'); |
|
| 275 | 275 | |
| 276 | - /** |
|
| 277 | - * Setting of the PHP error exception handling function |
|
| 278 | - */ |
|
| 279 | - set_exception_handler('php_exception_handler'); |
|
| 276 | + /** |
|
| 277 | + * Setting of the PHP error exception handling function |
|
| 278 | + */ |
|
| 279 | + set_exception_handler('php_exception_handler'); |
|
| 280 | 280 | |
| 281 | - /** |
|
| 282 | - * Setting of the PHP shutdown handling function |
|
| 283 | - */ |
|
| 284 | - register_shutdown_function('php_shudown_handler'); |
|
| 281 | + /** |
|
| 282 | + * Setting of the PHP shutdown handling function |
|
| 283 | + */ |
|
| 284 | + register_shutdown_function('php_shudown_handler'); |
|
| 285 | 285 | |
| 286 | - /** |
|
| 287 | - * Register the tests autoload |
|
| 288 | - */ |
|
| 289 | - spl_autoload_register('tests_autoload'); |
|
| 286 | + /** |
|
| 287 | + * Register the tests autoload |
|
| 288 | + */ |
|
| 289 | + spl_autoload_register('tests_autoload'); |
|
| 290 | 290 | |
| 291 | 291 | |
| 292 | - |
|
| 293 | 292 | \ No newline at end of file |
| 293 | + |
|
| 294 | 294 | \ No newline at end of file |
@@ -1,31 +1,31 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use PHPUnit\Framework\TestCase; |
|
| 3 | + use PHPUnit\Framework\TestCase; |
|
| 4 | 4 | |
| 5 | - class RequestTest extends TestCase |
|
| 6 | - { |
|
| 5 | + class RequestTest extends TestCase |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | - public static function setUpBeforeClass() |
|
| 9 | - { |
|
| 8 | + public static function setUpBeforeClass() |
|
| 9 | + { |
|
| 10 | 10 | |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public static function tearDownAfterClass() |
|
| 14 | - { |
|
| 13 | + public static function tearDownAfterClass() |
|
| 14 | + { |
|
| 15 | 15 | |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - protected function setUp() |
|
| 19 | - { |
|
| 20 | - } |
|
| 18 | + protected function setUp() |
|
| 19 | + { |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - protected function tearDown() |
|
| 23 | - { |
|
| 24 | - } |
|
| 22 | + protected function tearDown() |
|
| 23 | + { |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function testNotYet() |
|
| 27 | - { |
|
| 28 | - $this->markTestSkipped(); |
|
| 29 | - } |
|
| 26 | + public function testNotYet() |
|
| 27 | + { |
|
| 28 | + $this->markTestSkipped(); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - } |
|
| 32 | 31 | \ No newline at end of file |
| 32 | + } |
|
| 33 | 33 | \ No newline at end of file |
@@ -1,31 +1,31 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use PHPUnit\Framework\TestCase; |
|
| 3 | + use PHPUnit\Framework\TestCase; |
|
| 4 | 4 | |
| 5 | - class LoaderTest extends TestCase |
|
| 6 | - { |
|
| 5 | + class LoaderTest extends TestCase |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | - public static function setUpBeforeClass() |
|
| 9 | - { |
|
| 8 | + public static function setUpBeforeClass() |
|
| 9 | + { |
|
| 10 | 10 | |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public static function tearDownAfterClass() |
|
| 14 | - { |
|
| 13 | + public static function tearDownAfterClass() |
|
| 14 | + { |
|
| 15 | 15 | |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - protected function setUp() |
|
| 19 | - { |
|
| 20 | - } |
|
| 18 | + protected function setUp() |
|
| 19 | + { |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - protected function tearDown() |
|
| 23 | - { |
|
| 24 | - } |
|
| 22 | + protected function tearDown() |
|
| 23 | + { |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function testNotYet() |
|
| 27 | - { |
|
| 28 | - $this->markTestSkipped(); |
|
| 29 | - } |
|
| 26 | + public function testNotYet() |
|
| 27 | + { |
|
| 28 | + $this->markTestSkipped(); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - } |
|
| 32 | 31 | \ No newline at end of file |
| 32 | + } |
|
| 33 | 33 | \ No newline at end of file |
@@ -1,33 +1,33 @@ |
||
| 1 | 1 | <?php |
| 2 | - use PHPUnit\Framework\TestCase; |
|
| 2 | + use PHPUnit\Framework\TestCase; |
|
| 3 | 3 | |
| 4 | - class SessionTest extends TestCase |
|
| 5 | - { |
|
| 4 | + class SessionTest extends TestCase |
|
| 5 | + { |
|
| 6 | 6 | |
| 7 | - public static function setUpBeforeClass() |
|
| 8 | - { |
|
| 7 | + public static function setUpBeforeClass() |
|
| 8 | + { |
|
| 9 | 9 | |
| 10 | - } |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public static function tearDownAfterClass() |
|
| 13 | - { |
|
| 12 | + public static function tearDownAfterClass() |
|
| 13 | + { |
|
| 14 | 14 | |
| 15 | - } |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | - protected function setUp() |
|
| 19 | - { |
|
| 20 | - } |
|
| 18 | + protected function setUp() |
|
| 19 | + { |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - protected function tearDown() |
|
| 23 | - { |
|
| 24 | - } |
|
| 22 | + protected function tearDown() |
|
| 23 | + { |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - // tests |
|
| 27 | - public function testSomeFeature() |
|
| 28 | - { |
|
| 29 | - Session::set('foo', 'bar'); |
|
| 30 | - $this->assertEquals('bar', Session::get('foo')); |
|
| 31 | - //$this->expectException(InvalidArgumentException::class); |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | 26 | \ No newline at end of file |
| 27 | + // tests |
|
| 28 | + public function testSomeFeature() |
|
| 29 | + { |
|
| 30 | + Session::set('foo', 'bar'); |
|
| 31 | + $this->assertEquals('bar', Session::get('foo')); |
|
| 32 | + //$this->expectException(InvalidArgumentException::class); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | \ No newline at end of file |
@@ -1,31 +1,31 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use PHPUnit\Framework\TestCase; |
|
| 3 | + use PHPUnit\Framework\TestCase; |
|
| 4 | 4 | |
| 5 | - class UrlTest extends TestCase |
|
| 6 | - { |
|
| 5 | + class UrlTest extends TestCase |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | - public static function setUpBeforeClass() |
|
| 9 | - { |
|
| 8 | + public static function setUpBeforeClass() |
|
| 9 | + { |
|
| 10 | 10 | |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public static function tearDownAfterClass() |
|
| 14 | - { |
|
| 13 | + public static function tearDownAfterClass() |
|
| 14 | + { |
|
| 15 | 15 | |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - protected function setUp() |
|
| 19 | - { |
|
| 20 | - } |
|
| 18 | + protected function setUp() |
|
| 19 | + { |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - protected function tearDown() |
|
| 23 | - { |
|
| 24 | - } |
|
| 22 | + protected function tearDown() |
|
| 23 | + { |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function testNotYet() |
|
| 27 | - { |
|
| 28 | - $this->markTestSkipped(); |
|
| 29 | - } |
|
| 26 | + public function testNotYet() |
|
| 27 | + { |
|
| 28 | + $this->markTestSkipped(); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - } |
|
| 32 | 31 | \ No newline at end of file |
| 32 | + } |
|
| 33 | 33 | \ No newline at end of file |
@@ -1,59 +1,59 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use PHPUnit\Framework\TestCase; |
|
| 3 | + use PHPUnit\Framework\TestCase; |
|
| 4 | 4 | |
| 5 | - class EventInfoTest extends TestCase |
|
| 6 | - { |
|
| 5 | + class EventInfoTest extends TestCase |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | - public static function setUpBeforeClass() |
|
| 9 | - { |
|
| 8 | + public static function setUpBeforeClass() |
|
| 9 | + { |
|
| 10 | 10 | |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public static function tearDownAfterClass() |
|
| 14 | - { |
|
| 13 | + public static function tearDownAfterClass() |
|
| 14 | + { |
|
| 15 | 15 | |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - protected function setUp() |
|
| 19 | - { |
|
| 20 | - } |
|
| 18 | + protected function setUp() |
|
| 19 | + { |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - protected function tearDown() |
|
| 23 | - { |
|
| 24 | - } |
|
| 22 | + protected function tearDown() |
|
| 23 | + { |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | - public function testDefaultValue(){ |
|
| 29 | - $e = new EventInfo('foo'); |
|
| 30 | - $this->assertSame($e->name, 'foo'); |
|
| 31 | - $this->assertSame($e->payload, array()); |
|
| 32 | - $this->assertFalse($e->returnBack); |
|
| 33 | - $this->assertFalse($e->stop); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - public function testPayloadValueIsSet(){ |
|
| 37 | - $e = new EventInfo('foo', array('bar')); |
|
| 38 | - $this->assertSame($e->name, 'foo'); |
|
| 39 | - $this->assertSame($e->payload, array('bar')); |
|
| 40 | - $this->assertFalse($e->returnBack); |
|
| 41 | - $this->assertFalse($e->stop); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - public function testReturnBackValueIsSetToTrue(){ |
|
| 45 | - $e = new EventInfo('foo', array('bar'), true); |
|
| 46 | - $this->assertSame($e->name, 'foo'); |
|
| 47 | - $this->assertSame($e->payload, array('bar')); |
|
| 48 | - $this->assertTrue($e->returnBack); |
|
| 49 | - $this->assertFalse($e->stop); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - public function testStopValueIsSetToTue(){ |
|
| 53 | - $e = new EventInfo('foo', array('bar'), true, true); |
|
| 54 | - $this->assertSame($e->name, 'foo'); |
|
| 55 | - $this->assertSame($e->payload, array('bar')); |
|
| 56 | - $this->assertTrue($e->returnBack); |
|
| 57 | - $this->assertTrue($e->stop); |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | 28 | \ No newline at end of file |
| 29 | + public function testDefaultValue(){ |
|
| 30 | + $e = new EventInfo('foo'); |
|
| 31 | + $this->assertSame($e->name, 'foo'); |
|
| 32 | + $this->assertSame($e->payload, array()); |
|
| 33 | + $this->assertFalse($e->returnBack); |
|
| 34 | + $this->assertFalse($e->stop); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + public function testPayloadValueIsSet(){ |
|
| 38 | + $e = new EventInfo('foo', array('bar')); |
|
| 39 | + $this->assertSame($e->name, 'foo'); |
|
| 40 | + $this->assertSame($e->payload, array('bar')); |
|
| 41 | + $this->assertFalse($e->returnBack); |
|
| 42 | + $this->assertFalse($e->stop); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + public function testReturnBackValueIsSetToTrue(){ |
|
| 46 | + $e = new EventInfo('foo', array('bar'), true); |
|
| 47 | + $this->assertSame($e->name, 'foo'); |
|
| 48 | + $this->assertSame($e->payload, array('bar')); |
|
| 49 | + $this->assertTrue($e->returnBack); |
|
| 50 | + $this->assertFalse($e->stop); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function testStopValueIsSetToTue(){ |
|
| 54 | + $e = new EventInfo('foo', array('bar'), true, true); |
|
| 55 | + $this->assertSame($e->name, 'foo'); |
|
| 56 | + $this->assertSame($e->payload, array('bar')); |
|
| 57 | + $this->assertTrue($e->returnBack); |
|
| 58 | + $this->assertTrue($e->stop); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | 61 | \ No newline at end of file |
@@ -1,31 +1,31 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use PHPUnit\Framework\TestCase; |
|
| 3 | + use PHPUnit\Framework\TestCase; |
|
| 4 | 4 | |
| 5 | - class LogTest extends TestCase |
|
| 6 | - { |
|
| 5 | + class LogTest extends TestCase |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | - public static function setUpBeforeClass() |
|
| 9 | - { |
|
| 8 | + public static function setUpBeforeClass() |
|
| 9 | + { |
|
| 10 | 10 | |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public static function tearDownAfterClass() |
|
| 14 | - { |
|
| 13 | + public static function tearDownAfterClass() |
|
| 14 | + { |
|
| 15 | 15 | |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - protected function setUp() |
|
| 19 | - { |
|
| 20 | - } |
|
| 18 | + protected function setUp() |
|
| 19 | + { |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - protected function tearDown() |
|
| 23 | - { |
|
| 24 | - } |
|
| 22 | + protected function tearDown() |
|
| 23 | + { |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function testNotYet() |
|
| 27 | - { |
|
| 28 | - $this->markTestSkipped(); |
|
| 29 | - } |
|
| 26 | + public function testNotYet() |
|
| 27 | + { |
|
| 28 | + $this->markTestSkipped(); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - } |
|
| 32 | 31 | \ No newline at end of file |
| 32 | + } |
|
| 33 | 33 | \ No newline at end of file |