@@ -1,31 +1,31 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use PHPUnit\Framework\TestCase; |
|
| 3 | + use PHPUnit\Framework\TestCase; |
|
| 4 | 4 | |
| 5 | - class DatabaseQueryRunnerTest extends TestCase |
|
| 6 | - { |
|
| 5 | + class DatabaseQueryRunnerTest 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,69 +1,69 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use PHPUnit\Framework\TestCase; |
|
| 3 | + use PHPUnit\Framework\TestCase; |
|
| 4 | 4 | |
| 5 | - class FunctionUserAgentTest extends TestCase |
|
| 6 | - { |
|
| 5 | + class FunctionUserAgentTest extends TestCase |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | - public static function setUpBeforeClass() |
|
| 9 | - { |
|
| 8 | + public static function setUpBeforeClass() |
|
| 9 | + { |
|
| 10 | 10 | require_once CORE_FUNCTIONS_PATH . 'function_user_agent.php'; |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function testLoopBack() |
|
| 14 | - { |
|
| 15 | - $this->assertEquals('127.0.0.1', get_ip()); |
|
| 16 | - } |
|
| 13 | + public function testLoopBack() |
|
| 14 | + { |
|
| 15 | + $this->assertEquals('127.0.0.1', get_ip()); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | 18 | public function testServerRemoteAddr() |
| 19 | - { |
|
| 19 | + { |
|
| 20 | 20 | $ip = '182.23.24.56'; |
| 21 | 21 | $_SERVER['REMOTE_ADDR'] = $ip; |
| 22 | - $this->assertEquals($ip, get_ip()); |
|
| 23 | - } |
|
| 22 | + $this->assertEquals($ip, get_ip()); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | public function testServerHttpClientIp() |
| 26 | - { |
|
| 26 | + { |
|
| 27 | 27 | $ip = '192.168.24.1'; |
| 28 | 28 | $_SERVER['HTTP_CLIENT_IP'] = $ip; |
| 29 | - $this->assertEquals($ip, get_ip()); |
|
| 30 | - } |
|
| 29 | + $this->assertEquals($ip, get_ip()); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | public function testServerHttpXForwardedFor() |
| 33 | - { |
|
| 33 | + { |
|
| 34 | 34 | $ip = '172.18.2.1'; |
| 35 | 35 | $_SERVER['HTTP_X_FORWARDED_FOR'] = $ip; |
| 36 | - $this->assertEquals($ip, get_ip()); |
|
| 37 | - } |
|
| 36 | + $this->assertEquals($ip, get_ip()); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | public function testServerHttpXForwarded() |
| 40 | - { |
|
| 40 | + { |
|
| 41 | 41 | |
| 42 | 42 | $ip = '12.18.2.1'; |
| 43 | 43 | $_SERVER['HTTP_X_FORWARDED'] = $ip; |
| 44 | - $this->assertEquals($ip, get_ip()); |
|
| 45 | - } |
|
| 44 | + $this->assertEquals($ip, get_ip()); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | public function testServerHttpForwardedFor() |
| 48 | - { |
|
| 48 | + { |
|
| 49 | 49 | $ip = '198.180.2.1'; |
| 50 | 50 | $_SERVER['HTTP_FORWARDED_FOR'] = $ip; |
| 51 | - $this->assertEquals($ip, get_ip()); |
|
| 52 | - } |
|
| 51 | + $this->assertEquals($ip, get_ip()); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | public function testServerHttpForwarded() |
| 55 | - { |
|
| 55 | + { |
|
| 56 | 56 | $ip = '220.200.2.1'; |
| 57 | 57 | $_SERVER['HTTP_FORWARDED'] = $ip; |
| 58 | - $this->assertEquals($ip, get_ip()); |
|
| 59 | - } |
|
| 58 | + $this->assertEquals($ip, get_ip()); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function testManyIp() |
|
| 62 | - { |
|
| 61 | + public function testManyIp() |
|
| 62 | + { |
|
| 63 | 63 | $ips = '20.200.2.1, 192.168.34.4'; |
| 64 | 64 | $ip = '20.200.2.1'; |
| 65 | 65 | $_SERVER['REMOTE_ADDR'] = $ips; |
| 66 | - $this->assertEquals($ip, get_ip()); |
|
| 67 | - } |
|
| 66 | + $this->assertEquals($ip, get_ip()); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - } |
|
| 70 | 69 | \ No newline at end of file |
| 70 | + } |
|
| 71 | 71 | \ No newline at end of file |
@@ -1,287 +1,287 @@ |
||
| 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 | - /** |
|
| 45 | - * The path to the directory. |
|
| 46 | - * |
|
| 47 | - * That contains your static files (javascript, css, images, etc.) |
|
| 48 | - * Note: the path must be relative to the file index.php (the front-end controller). |
|
| 49 | - */ |
|
| 50 | - define('ASSETS_PATH', 'assets/'); |
|
| 44 | + /** |
|
| 45 | + * The path to the directory. |
|
| 46 | + * |
|
| 47 | + * That contains your static files (javascript, css, images, etc.) |
|
| 48 | + * Note: the path must be relative to the file index.php (the front-end controller). |
|
| 49 | + */ |
|
| 50 | + define('ASSETS_PATH', 'assets/'); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * The path to the directory of your cache files. |
|
| 54 | - * |
|
| 55 | - * This feature is available currently for database and views. |
|
| 56 | - */ |
|
| 57 | - define('CACHE_PATH', ROOT_PATH . 'cache' . DS); |
|
| 52 | + /** |
|
| 53 | + * The path to the directory of your cache files. |
|
| 54 | + * |
|
| 55 | + * This feature is available currently for database and views. |
|
| 56 | + */ |
|
| 57 | + define('CACHE_PATH', ROOT_PATH . 'cache' . DS); |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Custom application path for tests |
|
| 61 | - */ |
|
| 62 | - define('APPS_PATH', TESTS_PATH .'hmvc' . DS); |
|
| 59 | + /** |
|
| 60 | + * Custom application path for tests |
|
| 61 | + */ |
|
| 62 | + define('APPS_PATH', TESTS_PATH .'hmvc' . DS); |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * The path to the controller directory of your application. |
|
| 66 | - * |
|
| 67 | - * If you already know the MVC architecture you know what a controller means; |
|
| 68 | - * it is he who makes the business logic of your application in general. |
|
| 69 | - */ |
|
| 70 | - define('APPS_CONTROLLER_PATH', APPS_PATH . 'controllers' . DS); |
|
| 64 | + /** |
|
| 65 | + * The path to the controller directory of your application. |
|
| 66 | + * |
|
| 67 | + * If you already know the MVC architecture you know what a controller means; |
|
| 68 | + * it is he who makes the business logic of your application in general. |
|
| 69 | + */ |
|
| 70 | + define('APPS_CONTROLLER_PATH', APPS_PATH . 'controllers' . DS); |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * The path to the directory of your model classes of your application. |
|
| 74 | - * |
|
| 75 | - * If you already know the MVC architecture you know what a model means; |
|
| 76 | - * it's the one who interacts with the database, in one word persistent data from your application. |
|
| 77 | - */ |
|
| 78 | - define('APPS_MODEL_PATH', APPS_PATH . 'models' . DS); |
|
| 72 | + /** |
|
| 73 | + * The path to the directory of your model classes of your application. |
|
| 74 | + * |
|
| 75 | + * If you already know the MVC architecture you know what a model means; |
|
| 76 | + * it's the one who interacts with the database, in one word persistent data from your application. |
|
| 77 | + */ |
|
| 78 | + define('APPS_MODEL_PATH', APPS_PATH . 'models' . DS); |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * The path to the directory of your views. |
|
| 82 | - * |
|
| 83 | - * If you already know the MVC architecture you know what a view means, |
|
| 84 | - * a view is just a user interface (html page, form, etc.) that is to say |
|
| 85 | - * everything displayed in the browser interface, etc. |
|
| 86 | - */ |
|
| 87 | - define('APPS_VIEWS_PATH', APPS_PATH . 'views' . DS); |
|
| 80 | + /** |
|
| 81 | + * The path to the directory of your views. |
|
| 82 | + * |
|
| 83 | + * If you already know the MVC architecture you know what a view means, |
|
| 84 | + * a view is just a user interface (html page, form, etc.) that is to say |
|
| 85 | + * everything displayed in the browser interface, etc. |
|
| 86 | + */ |
|
| 87 | + define('APPS_VIEWS_PATH', APPS_PATH . 'views' . DS); |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * The path to the configuration directory. |
|
| 91 | - * |
|
| 92 | - * That contains most of the configuration files for your |
|
| 93 | - * application (database, class loading file, functions, etc.) |
|
| 94 | - */ |
|
| 95 | - define('CONFIG_PATH', ROOT_PATH . 'config' . DS); |
|
| 89 | + /** |
|
| 90 | + * The path to the configuration directory. |
|
| 91 | + * |
|
| 92 | + * That contains most of the configuration files for your |
|
| 93 | + * application (database, class loading file, functions, etc.) |
|
| 94 | + */ |
|
| 95 | + define('CONFIG_PATH', ROOT_PATH . 'config' . DS); |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * The core directory |
|
| 99 | - * |
|
| 100 | - * It is recommended to put this folder out of the web directory of your server and |
|
| 101 | - * you should not change its content because in case of update you could lose the modified files. |
|
| 102 | - */ |
|
| 103 | - define('CORE_PATH', ROOT_PATH . 'core' . DS); |
|
| 97 | + /** |
|
| 98 | + * The core directory |
|
| 99 | + * |
|
| 100 | + * It is recommended to put this folder out of the web directory of your server and |
|
| 101 | + * you should not change its content because in case of update you could lose the modified files. |
|
| 102 | + */ |
|
| 103 | + define('CORE_PATH', ROOT_PATH . 'core' . DS); |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * The path to the directory of core classes that used by the system. |
|
| 107 | - * |
|
| 108 | - * It contains PHP classes that are used by the framework internally. |
|
| 109 | - */ |
|
| 110 | - define('CORE_CLASSES_PATH', CORE_PATH . 'classes' . DS); |
|
| 105 | + /** |
|
| 106 | + * The path to the directory of core classes that used by the system. |
|
| 107 | + * |
|
| 108 | + * It contains PHP classes that are used by the framework internally. |
|
| 109 | + */ |
|
| 110 | + define('CORE_CLASSES_PATH', CORE_PATH . 'classes' . DS); |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * The path to the directory of core classes for the cache used by the system. |
|
| 114 | - * |
|
| 115 | - * It contains PHP classes for the cache drivers. |
|
| 116 | - */ |
|
| 117 | - define('CORE_CLASSES_CACHE_PATH', CORE_CLASSES_PATH . 'cache' . DS); |
|
| 112 | + /** |
|
| 113 | + * The path to the directory of core classes for the cache used by the system. |
|
| 114 | + * |
|
| 115 | + * It contains PHP classes for the cache drivers. |
|
| 116 | + */ |
|
| 117 | + define('CORE_CLASSES_CACHE_PATH', CORE_CLASSES_PATH . 'cache' . DS); |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * The path to the directory of core classes for the database used by the system. |
|
| 121 | - * |
|
| 122 | - * It contains PHP classes for the database library, drivers, etc. |
|
| 123 | - */ |
|
| 124 | - define('CORE_CLASSES_DATABASE_PATH', CORE_CLASSES_PATH . 'database' . DS); |
|
| 120 | + * The path to the directory of core classes for the database used by the system. |
|
| 121 | + * |
|
| 122 | + * It contains PHP classes for the database library, drivers, etc. |
|
| 123 | + */ |
|
| 124 | + define('CORE_CLASSES_DATABASE_PATH', CORE_CLASSES_PATH . 'database' . DS); |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * The path to the directory of core classes for the model used by the system. |
|
| 128 | - * |
|
| 129 | - * It contains PHP classes for the models. |
|
| 130 | - */ |
|
| 131 | - define('CORE_CLASSES_MODEL_PATH', CORE_CLASSES_PATH . 'model' . DS); |
|
| 126 | + /** |
|
| 127 | + * The path to the directory of core classes for the model used by the system. |
|
| 128 | + * |
|
| 129 | + * It contains PHP classes for the models. |
|
| 130 | + */ |
|
| 131 | + define('CORE_CLASSES_MODEL_PATH', CORE_CLASSES_PATH . 'model' . DS); |
|
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * The path to the directory of functions or helper systems. |
|
| 135 | - * |
|
| 136 | - * It contains PHP functions that perform a particular task: character string processing, URL, etc. |
|
| 137 | - */ |
|
| 138 | - define('CORE_FUNCTIONS_PATH', CORE_PATH . 'functions' . DS); |
|
| 133 | + /** |
|
| 134 | + * The path to the directory of functions or helper systems. |
|
| 135 | + * |
|
| 136 | + * It contains PHP functions that perform a particular task: character string processing, URL, etc. |
|
| 137 | + */ |
|
| 138 | + define('CORE_FUNCTIONS_PATH', CORE_PATH . 'functions' . DS); |
|
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * The path to the core directory of languages files. |
|
| 142 | - * |
|
| 143 | - */ |
|
| 144 | - define('CORE_LANG_PATH', CORE_PATH . 'lang' . DS); |
|
| 140 | + /** |
|
| 141 | + * The path to the core directory of languages files. |
|
| 142 | + * |
|
| 143 | + */ |
|
| 144 | + define('CORE_LANG_PATH', CORE_PATH . 'lang' . DS); |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * The path to the system library directory. |
|
| 148 | - * |
|
| 149 | - * Which contains the libraries most often used in your web application, as for the |
|
| 150 | - * core directory it is advisable to put it out of the root directory of your application. |
|
| 151 | - */ |
|
| 152 | - define('CORE_LIBRARY_PATH', CORE_PATH . 'libraries' . DS); |
|
| 146 | + /** |
|
| 147 | + * The path to the system library directory. |
|
| 148 | + * |
|
| 149 | + * Which contains the libraries most often used in your web application, as for the |
|
| 150 | + * core directory it is advisable to put it out of the root directory of your application. |
|
| 151 | + */ |
|
| 152 | + define('CORE_LIBRARY_PATH', CORE_PATH . 'libraries' . DS); |
|
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * The path to the system view directory. |
|
| 156 | - * |
|
| 157 | - * That contains the views used for the system, such as error messages, and so on. |
|
| 158 | - */ |
|
| 159 | - define('CORE_VIEWS_PATH', CORE_PATH . 'views' . DS); |
|
| 154 | + /** |
|
| 155 | + * The path to the system view directory. |
|
| 156 | + * |
|
| 157 | + * That contains the views used for the system, such as error messages, and so on. |
|
| 158 | + */ |
|
| 159 | + define('CORE_VIEWS_PATH', CORE_PATH . 'views' . DS); |
|
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * The path to the directory of your PHP personal functions or helper. |
|
| 163 | - * |
|
| 164 | - * It contains your PHP functions that perform a particular task: utilities, etc. |
|
| 165 | - * Note: Do not put your personal functions or helpers in the system functions directory, |
|
| 166 | - * because if you update the system you may lose them. |
|
| 167 | - */ |
|
| 168 | - define('FUNCTIONS_PATH', ROOT_PATH . 'functions' . DS); |
|
| 161 | + /** |
|
| 162 | + * The path to the directory of your PHP personal functions or helper. |
|
| 163 | + * |
|
| 164 | + * It contains your PHP functions that perform a particular task: utilities, etc. |
|
| 165 | + * Note: Do not put your personal functions or helpers in the system functions directory, |
|
| 166 | + * because if you update the system you may lose them. |
|
| 167 | + */ |
|
| 168 | + define('FUNCTIONS_PATH', ROOT_PATH . 'functions' . DS); |
|
| 169 | 169 | |
| 170 | - /** |
|
| 171 | - * The path to the app directory of personal language. |
|
| 172 | - * |
|
| 173 | - * This feature is not yet available. |
|
| 174 | - * You can help us do this if you are nice or wish to see the developed framework. |
|
| 175 | - */ |
|
| 176 | - define('APP_LANG_PATH', ROOT_PATH . 'lang' . DS); |
|
| 170 | + /** |
|
| 171 | + * The path to the app directory of personal language. |
|
| 172 | + * |
|
| 173 | + * This feature is not yet available. |
|
| 174 | + * You can help us do this if you are nice or wish to see the developed framework. |
|
| 175 | + */ |
|
| 176 | + define('APP_LANG_PATH', ROOT_PATH . 'lang' . DS); |
|
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * The path to the directory of your personal libraries |
|
| 180 | - * |
|
| 181 | - * It contains your PHP classes, package, etc. |
|
| 182 | - * Note: you should not put your personal libraries in the system library directory, |
|
| 183 | - * because it is recalled in case of updating the system you might have surprises. |
|
| 184 | - */ |
|
| 185 | - define('LIBRARY_PATH', ROOT_PATH . 'libraries' . DS); |
|
| 178 | + /** |
|
| 179 | + * The path to the directory of your personal libraries |
|
| 180 | + * |
|
| 181 | + * It contains your PHP classes, package, etc. |
|
| 182 | + * Note: you should not put your personal libraries in the system library directory, |
|
| 183 | + * because it is recalled in case of updating the system you might have surprises. |
|
| 184 | + */ |
|
| 185 | + define('LIBRARY_PATH', ROOT_PATH . 'libraries' . DS); |
|
| 186 | 186 | |
| 187 | - /** |
|
| 188 | - * The path to the directory that contains the log files. |
|
| 189 | - * |
|
| 190 | - * Note: This directory must be available in writing and if possible must have as owner the user who launches your web server, |
|
| 191 | - * under unix or linux most often with the apache web server it is "www-data" or "httpd" even "nobody" for more |
|
| 192 | - * details see the documentation of your web server. |
|
| 193 | - * Example for Unix or linux with apache web server: |
|
| 194 | - * # chmod -R 700 /path/to/your/logs/directory/ |
|
| 195 | - * # chown -R www-data:www-data /path/to/your/logs/directory/ |
|
| 196 | - */ |
|
| 197 | - define('LOGS_PATH', ROOT_PATH . 'logs' . DS); |
|
| 187 | + /** |
|
| 188 | + * The path to the directory that contains the log files. |
|
| 189 | + * |
|
| 190 | + * Note: This directory must be available in writing and if possible must have as owner the user who launches your web server, |
|
| 191 | + * under unix or linux most often with the apache web server it is "www-data" or "httpd" even "nobody" for more |
|
| 192 | + * details see the documentation of your web server. |
|
| 193 | + * Example for Unix or linux with apache web server: |
|
| 194 | + * # chmod -R 700 /path/to/your/logs/directory/ |
|
| 195 | + * # chown -R www-data:www-data /path/to/your/logs/directory/ |
|
| 196 | + */ |
|
| 197 | + define('LOGS_PATH', ROOT_PATH . 'logs' . DS); |
|
| 198 | 198 | |
| 199 | - /** |
|
| 200 | - * The path to the modules directory. |
|
| 201 | - * |
|
| 202 | - * It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, |
|
| 203 | - * in HMVC architecture (hierichical, controllers, models, views). |
|
| 204 | - */ |
|
| 205 | - define('MODULE_PATH', dirname(realpath(__FILE__)) . DS .'hmvc' . DS . 'modules' . DS); |
|
| 199 | + /** |
|
| 200 | + * The path to the modules directory. |
|
| 201 | + * |
|
| 202 | + * It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, |
|
| 203 | + * in HMVC architecture (hierichical, controllers, models, views). |
|
| 204 | + */ |
|
| 205 | + define('MODULE_PATH', dirname(realpath(__FILE__)) . DS .'hmvc' . DS . 'modules' . DS); |
|
| 206 | 206 | |
| 207 | - /** |
|
| 208 | - * The path to the directory of sources external to your application. |
|
| 209 | - * |
|
| 210 | - * If you have already used "composer" you know what that means. |
|
| 211 | - */ |
|
| 212 | - define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS); |
|
| 207 | + /** |
|
| 208 | + * The path to the directory of sources external to your application. |
|
| 209 | + * |
|
| 210 | + * If you have already used "composer" you know what that means. |
|
| 211 | + */ |
|
| 212 | + define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS); |
|
| 213 | 213 | |
| 214 | - /** |
|
| 215 | - * The front controller of your application. |
|
| 216 | - * |
|
| 217 | - * "index.php" it is through this file that all the requests come, there is a possibility to hidden it in the url of |
|
| 218 | - * your application by using the rewrite module URL of your web server . |
|
| 219 | - * For example, under apache web server, there is a configuration example file that is located at the root |
|
| 220 | - * of your framework folder : "htaccess.txt" rename it to ".htaccess". |
|
| 221 | - */ |
|
| 222 | - define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
|
| 214 | + /** |
|
| 215 | + * The front controller of your application. |
|
| 216 | + * |
|
| 217 | + * "index.php" it is through this file that all the requests come, there is a possibility to hidden it in the url of |
|
| 218 | + * your application by using the rewrite module URL of your web server . |
|
| 219 | + * For example, under apache web server, there is a configuration example file that is located at the root |
|
| 220 | + * of your framework folder : "htaccess.txt" rename it to ".htaccess". |
|
| 221 | + */ |
|
| 222 | + define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
|
| 223 | 223 | |
| 224 | - /** |
|
| 225 | - * Check if user run the application under CLI |
|
| 226 | - */ |
|
| 227 | - define('IS_CLI', stripos('cli', php_sapi_name()) !== false); |
|
| 224 | + /** |
|
| 225 | + * Check if user run the application under CLI |
|
| 226 | + */ |
|
| 227 | + define('IS_CLI', stripos('cli', php_sapi_name()) !== false); |
|
| 228 | 228 | |
| 229 | - /** |
|
| 230 | - * The environment of your application (production, test, development). |
|
| 231 | - * |
|
| 232 | - * if your application is still in development you use the value "development" |
|
| 233 | - * so you will have the display of the error messages, etc. |
|
| 234 | - * Once you finish the development of your application that is to put it online |
|
| 235 | - * you change this value to "production" or "testing", in this case there will be deactivation of error messages, |
|
| 236 | - * the loading of the system, will be fast. |
|
| 237 | - */ |
|
| 238 | - define('ENVIRONMENT', 'testing'); |
|
| 229 | + /** |
|
| 230 | + * The environment of your application (production, test, development). |
|
| 231 | + * |
|
| 232 | + * if your application is still in development you use the value "development" |
|
| 233 | + * so you will have the display of the error messages, etc. |
|
| 234 | + * Once you finish the development of your application that is to put it online |
|
| 235 | + * you change this value to "production" or "testing", in this case there will be deactivation of error messages, |
|
| 236 | + * the loading of the system, will be fast. |
|
| 237 | + */ |
|
| 238 | + define('ENVIRONMENT', 'testing'); |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - //Fix to allow test as if application is running in CLI mode $_SESSION global variable is not available |
|
| 242 | - $_SESSION = array(); |
|
| 241 | + //Fix to allow test as if application is running in CLI mode $_SESSION global variable is not available |
|
| 242 | + $_SESSION = array(); |
|
| 243 | 243 | |
| 244 | - //check for composer autoload file if exists include it |
|
| 245 | - if (file_exists(VENDOR_PATH . 'autoload.php')){ |
|
| 246 | - require_once VENDOR_PATH . 'autoload.php'; |
|
| 244 | + //check for composer autoload file if exists include it |
|
| 245 | + if (file_exists(VENDOR_PATH . 'autoload.php')){ |
|
| 246 | + require_once VENDOR_PATH . 'autoload.php'; |
|
| 247 | 247 | |
| 248 | - //define the class alias for vstream |
|
| 249 | - class_alias('org\bovigo\vfs\vfsStream', 'vfsStream'); |
|
| 250 | - class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory'); |
|
| 251 | - class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper'); |
|
| 248 | + //define the class alias for vstream |
|
| 249 | + class_alias('org\bovigo\vfs\vfsStream', 'vfsStream'); |
|
| 250 | + class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory'); |
|
| 251 | + class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper'); |
|
| 252 | 252 | |
| 253 | - } |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | - //require autoloader for test |
|
| 256 | - require_once 'include/autoloader.php'; |
|
| 255 | + //require autoloader for test |
|
| 256 | + require_once 'include/autoloader.php'; |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | |
| 260 | - //grap from core/common.php functions and mock some functions for tests |
|
| 261 | - require_once 'include/common.php'; |
|
| 260 | + //grap from core/common.php functions and mock some functions for tests |
|
| 261 | + require_once 'include/common.php'; |
|
| 262 | 262 | |
| 263 | - //Some utilities functions, classes, etc. |
|
| 264 | - require_once 'include/testsUtil.php'; |
|
| 263 | + //Some utilities functions, classes, etc. |
|
| 264 | + require_once 'include/testsUtil.php'; |
|
| 265 | 265 | |
| 266 | - /** |
|
| 267 | - * Setting of the PHP error message handling function |
|
| 268 | - */ |
|
| 269 | - set_error_handler('php_error_handler'); |
|
| 266 | + /** |
|
| 267 | + * Setting of the PHP error message handling function |
|
| 268 | + */ |
|
| 269 | + set_error_handler('php_error_handler'); |
|
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * Setting of the PHP error exception handling function |
|
| 273 | - */ |
|
| 274 | - set_exception_handler('php_exception_handler'); |
|
| 271 | + /** |
|
| 272 | + * Setting of the PHP error exception handling function |
|
| 273 | + */ |
|
| 274 | + set_exception_handler('php_exception_handler'); |
|
| 275 | 275 | |
| 276 | - /** |
|
| 277 | - * Setting of the PHP shutdown handling function |
|
| 278 | - */ |
|
| 279 | - register_shutdown_function('php_shudown_handler'); |
|
| 276 | + /** |
|
| 277 | + * Setting of the PHP shutdown handling function |
|
| 278 | + */ |
|
| 279 | + register_shutdown_function('php_shudown_handler'); |
|
| 280 | 280 | |
| 281 | - /** |
|
| 282 | - * Register the tests autoload |
|
| 283 | - */ |
|
| 284 | - spl_autoload_register('tests_autoload'); |
|
| 281 | + /** |
|
| 282 | + * Register the tests autoload |
|
| 283 | + */ |
|
| 284 | + spl_autoload_register('tests_autoload'); |
|
| 285 | 285 | |
| 286 | 286 | |
| 287 | - |
|
| 288 | 287 | \ No newline at end of file |
| 288 | + |
|
| 289 | 289 | \ No newline at end of file |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * Custom application path for tests |
| 61 | 61 | */ |
| 62 | - define('APPS_PATH', TESTS_PATH .'hmvc' . DS); |
|
| 62 | + define('APPS_PATH', TESTS_PATH . 'hmvc' . DS); |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * The path to the controller directory of your application. |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * It contains your modules used files (config, controllers, libraries, etc.) that is to say which contains your files of the modules, |
| 203 | 203 | * in HMVC architecture (hierichical, controllers, models, views). |
| 204 | 204 | */ |
| 205 | - define('MODULE_PATH', dirname(realpath(__FILE__)) . DS .'hmvc' . DS . 'modules' . DS); |
|
| 205 | + define('MODULE_PATH', dirname(realpath(__FILE__)) . DS . 'hmvc' . DS . 'modules' . DS); |
|
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | 208 | * The path to the directory of sources external to your application. |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $_SESSION = array(); |
| 243 | 243 | |
| 244 | 244 | //check for composer autoload file if exists include it |
| 245 | - if (file_exists(VENDOR_PATH . 'autoload.php')){ |
|
| 245 | + if (file_exists(VENDOR_PATH . 'autoload.php')) { |
|
| 246 | 246 | require_once VENDOR_PATH . 'autoload.php'; |
| 247 | 247 | |
| 248 | 248 | //define the class alias for vstream |