@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | //Autoload function |
| 3 | - function test_autoload($class){ |
|
| 3 | + function test_autoload($class) { |
|
| 4 | 4 | $classesMap = array( |
| 5 | 5 | //Caches |
| 6 | 6 | 'ApcCache' => CORE_CLASSES_CACHE_PATH . 'ApcCache.php', |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | 'StringHash' => CORE_LIBRARY_PATH . 'StringHash.php', |
| 40 | 40 | 'Upload' => CORE_LIBRARY_PATH . 'Upload.php', |
| 41 | 41 | ); |
| 42 | - if(isset($classesMap[$class])){ |
|
| 43 | - if(file_exists($classesMap[$class])){ |
|
| 42 | + if (isset($classesMap[$class])) { |
|
| 43 | + if (file_exists($classesMap[$class])) { |
|
| 44 | 44 | include_once $classesMap[$class]; |
| 45 | 45 | } |
| 46 | - else{ |
|
| 46 | + else { |
|
| 47 | 47 | echo 'File for class ' . $class . ' not found'; |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | if(isset($classesMap[$class])){ |
| 43 | 43 | if(file_exists($classesMap[$class])){ |
| 44 | 44 | include_once $classesMap[$class]; |
| 45 | - } |
|
| 46 | - else{ |
|
| 45 | + } else{ |
|
| 47 | 46 | echo 'File for class ' . $class . ' not found'; |
| 48 | 47 | } |
| 49 | 48 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * You should have received a copy of the GNU General Public License |
| 23 | 23 | * along with this program; if not, write to the Free Software |
| 24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | - */ |
|
| 25 | + */ |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | function & class_loader($class, $dir = 'libraries', $params = null){ |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * @test |
|
| 96 | - */ |
|
| 95 | + * @test |
|
| 96 | + */ |
|
| 97 | 97 | function get_config($key, $default = null){ |
| 98 | 98 | static $cfg; |
| 99 | 99 | if(empty($cfg)){ |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | - * @test |
|
| 125 | - */ |
|
| 124 | + * @test |
|
| 125 | + */ |
|
| 126 | 126 | function is_url($url){ |
| 127 | 127 | return preg_match('/^(http|https|ftp):\/\/(.*)/', $url); |
| 128 | 128 | } |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | - * @test |
|
| 146 | - */ |
|
| 145 | + * @test |
|
| 146 | + */ |
|
| 147 | 147 | function attributes_to_string(array $attributes){ |
| 148 | 148 | $str = ' '; |
| 149 | 149 | //we check that the array passed as an argument is not empty. |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | - * @test |
|
| 177 | - */ |
|
| 176 | + * @test |
|
| 177 | + */ |
|
| 178 | 178 | function clean_input($str){ |
| 179 | 179 | if(is_array($str)){ |
| 180 | 180 | $str = array_map('clean_input', $str); |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | - * @test |
|
| 197 | - */ |
|
| 196 | + * @test |
|
| 197 | + */ |
|
| 198 | 198 | function string_hidden($str, $startCount = 0, $endCount = 0, $hiddenChar = '*'){ |
| 199 | 199 | //get the string length |
| 200 | 200 | $len = strlen($str); |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | //put the first letter of class to upper case |
| 30 | 30 | $class = ucfirst($class); |
| 31 | 31 | static $classes = array(); |
| 32 | - if(isset($classes[$class]) /*hack for duplicate log Logger name*/ && $class != 'Log'){ |
|
| 32 | + if (isset($classes[$class]) /*hack for duplicate log Logger name*/ && $class != 'Log') { |
|
| 33 | 33 | return $classes[$class]; |
| 34 | 34 | } |
| 35 | 35 | $found = false; |
| 36 | 36 | foreach (array(ROOT_PATH, CORE_PATH) as $path) { |
| 37 | 37 | $file = $path . $dir . '/' . $class . '.php'; |
| 38 | - if(file_exists($file)){ |
|
| 39 | - if(class_exists($class, false) == false){ |
|
| 38 | + if (file_exists($file)) { |
|
| 39 | + if (class_exists($class, false) == false) { |
|
| 40 | 40 | require_once $file; |
| 41 | 41 | } |
| 42 | 42 | //already found |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | break; |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - if(! $found){ |
|
| 47 | + if (!$found) { |
|
| 48 | 48 | //can't use show_error() at this time because some dependencies not yet loaded |
| 49 | 49 | set_http_status_header(503); |
| 50 | 50 | echo 'Cannot find the class [' . $class . ']'; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | /* |
| 55 | 55 | TODO use the best method to get the Log instance |
| 56 | 56 | */ |
| 57 | - if($class == 'Log'){ |
|
| 57 | + if ($class == 'Log') { |
|
| 58 | 58 | //can't use the instruction like "return new Log()" |
| 59 | 59 | //because we need return the reference instance of the loaded class. |
| 60 | 60 | $log = new Log(); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | function & class_loaded($class = null){ |
| 74 | 74 | static $list = array(); |
| 75 | - if($class != null){ |
|
| 75 | + if ($class != null) { |
|
| 76 | 76 | $list[strtolower($class)] = $class; |
| 77 | 77 | } |
| 78 | 78 | return $list; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | function & load_configurations(array $overwrite_values = array()){ |
| 82 | 82 | static $config; |
| 83 | - if(empty($config)){ |
|
| 83 | + if (empty($config)) { |
|
| 84 | 84 | $file = CONFIG_PATH . 'config.php'; |
| 85 | 85 | require_once $file; |
| 86 | 86 | |
@@ -94,49 +94,49 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * @test |
| 96 | 96 | */ |
| 97 | - function get_config($key, $default = null){ |
|
| 97 | + function get_config($key, $default = null) { |
|
| 98 | 98 | static $cfg; |
| 99 | - if(empty($cfg)){ |
|
| 99 | + if (empty($cfg)) { |
|
| 100 | 100 | $cfg[0] = & load_configurations(); |
| 101 | 101 | } |
| 102 | 102 | return array_key_exists($key, $cfg[0]) ? $cfg[0][$key] : $default; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - function save_to_log($level, $message, $logger = null){ |
|
| 105 | + function save_to_log($level, $message, $logger = null) { |
|
| 106 | 106 | return true; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
| 110 | - function set_http_status_header($code = 200, $text = null){ |
|
| 110 | + function set_http_status_header($code = 200, $text = null) { |
|
| 111 | 111 | return true; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | - function show_error($msg, $title = 'error', $logging = true){ |
|
| 115 | + function show_error($msg, $title = 'error', $logging = true) { |
|
| 116 | 116 | //throw new RuntimeException('TNHFW Error: '.$msg); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - function is_https(){ |
|
| 119 | + function is_https() { |
|
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * @test |
| 125 | 125 | */ |
| 126 | - function is_url($url){ |
|
| 126 | + function is_url($url) { |
|
| 127 | 127 | return preg_match('/^(http|https|ftp):\/\/(.*)/', $url); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - function php_exception_handler($ex){ |
|
| 131 | - throw new RuntimeException('PHP Exception : '.$ex->getMessage().' | '.$ex->getFile().' | '.$ex->getLine()); |
|
| 130 | + function php_exception_handler($ex) { |
|
| 131 | + throw new RuntimeException('PHP Exception : ' . $ex->getMessage() . ' | ' . $ex->getFile() . ' | ' . $ex->getLine()); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | - function php_error_handler($errno , $errstr, $errfile , $errline, array $errcontext = array()){ |
|
| 136 | - throw new RuntimeException('TNHFW Exception Error : '.$errstr.' | '.$errfile.' | '.$errline); |
|
| 135 | + function php_error_handler($errno, $errstr, $errfile, $errline, array $errcontext = array()) { |
|
| 136 | + throw new RuntimeException('TNHFW Exception Error : ' . $errstr . ' | ' . $errfile . ' | ' . $errline); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - function php_shudown_handler(){ |
|
| 139 | + function php_shudown_handler() { |
|
| 140 | 140 | return true; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | /** |
| 145 | 145 | * @test |
| 146 | 146 | */ |
| 147 | - function attributes_to_string(array $attributes){ |
|
| 147 | + function attributes_to_string(array $attributes) { |
|
| 148 | 148 | $str = ' '; |
| 149 | 149 | //we check that the array passed as an argument is not empty. |
| 150 | - if(! empty($attributes)){ |
|
| 151 | - foreach($attributes as $key => $value){ |
|
| 150 | + if (!empty($attributes)) { |
|
| 151 | + foreach ($attributes as $key => $value) { |
|
| 152 | 152 | $key = trim(htmlspecialchars($key)); |
| 153 | 153 | $value = trim(htmlspecialchars($value)); |
| 154 | 154 | /* |
@@ -158,35 +158,35 @@ discard block |
||
| 158 | 158 | * $attr = array('placeholder' => 'I am a "puple"') |
| 159 | 159 | * $str = attributes_to_string($attr); => placeholder = "I am a \"puple\"" |
| 160 | 160 | */ |
| 161 | - if($value && strpos('"', $value) !== false){ |
|
| 161 | + if ($value && strpos('"', $value) !== false) { |
|
| 162 | 162 | $value = addslashes($value); |
| 163 | 163 | } |
| 164 | - $str .= $key.' = "'.$value.'" '; |
|
| 164 | + $str .= $key . ' = "' . $value . '" '; |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | //remove the space after using rtrim() |
| 168 | 168 | return rtrim($str); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - function stringfy_vars($var){ |
|
| 171 | + function stringfy_vars($var) { |
|
| 172 | 172 | return print_r($var, true); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * @test |
| 177 | 177 | */ |
| 178 | - function clean_input($str){ |
|
| 179 | - if(is_array($str)){ |
|
| 178 | + function clean_input($str) { |
|
| 179 | + if (is_array($str)) { |
|
| 180 | 180 | $str = array_map('clean_input', $str); |
| 181 | 181 | } |
| 182 | - else if(is_object($str)){ |
|
| 182 | + else if (is_object($str)) { |
|
| 183 | 183 | $obj = $str; |
| 184 | 184 | foreach ($str as $var => $value) { |
| 185 | 185 | $obj->$var = clean_input($value); |
| 186 | 186 | } |
| 187 | 187 | $str = $obj; |
| 188 | 188 | } |
| 189 | - else{ |
|
| 189 | + else { |
|
| 190 | 190 | $str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8'); |
| 191 | 191 | } |
| 192 | 192 | return $str; |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | /** |
| 196 | 196 | * @test |
| 197 | 197 | */ |
| 198 | - function string_hidden($str, $startCount = 0, $endCount = 0, $hiddenChar = '*'){ |
|
| 198 | + function string_hidden($str, $startCount = 0, $endCount = 0, $hiddenChar = '*') { |
|
| 199 | 199 | //get the string length |
| 200 | 200 | $len = strlen($str); |
| 201 | 201 | //if str is empty |
| 202 | - if($len <= 0){ |
|
| 202 | + if ($len <= 0) { |
|
| 203 | 203 | return str_repeat($hiddenChar, 6); |
| 204 | 204 | } |
| 205 | 205 | //if the length is less than startCount and endCount |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | //or startCount is negative or endCount is negative |
| 208 | 208 | //return the full string hidden |
| 209 | 209 | |
| 210 | - if((($startCount + $endCount) > $len) || ($startCount == 0 && $endCount == 0) || ($startCount < 0 || $endCount < 0)){ |
|
| 210 | + if ((($startCount + $endCount) > $len) || ($startCount == 0 && $endCount == 0) || ($startCount < 0 || $endCount < 0)) { |
|
| 211 | 211 | return str_repeat($hiddenChar, $len); |
| 212 | 212 | } |
| 213 | 213 | //the start non hidden string |
| 214 | 214 | $startNonHiddenStr = substr($str, 0, $startCount); |
| 215 | 215 | //the end non hidden string |
| 216 | 216 | $endNonHiddenStr = null; |
| 217 | - if($endCount > 0){ |
|
| 217 | + if ($endCount > 0) { |
|
| 218 | 218 | $endNonHiddenStr = substr($str, - $endCount); |
| 219 | 219 | } |
| 220 | 220 | //the hidden string |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | return $startNonHiddenStr . $hiddenStr . $endNonHiddenStr; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - function set_session_config(){ |
|
| 226 | + function set_session_config() { |
|
| 227 | 227 | return true; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | function & get_instance(){ |
| 231 | - if(! Controller::get_instance()){ |
|
| 231 | + if (!Controller::get_instance()) { |
|
| 232 | 232 | $c = new Controller(); |
| 233 | 233 | } |
| 234 | 234 | return Controller::get_instance(); |
@@ -178,15 +178,13 @@ |
||
| 178 | 178 | function clean_input($str){ |
| 179 | 179 | if(is_array($str)){ |
| 180 | 180 | $str = array_map('clean_input', $str); |
| 181 | - } |
|
| 182 | - else if(is_object($str)){ |
|
| 181 | + } else if(is_object($str)){ |
|
| 183 | 182 | $obj = $str; |
| 184 | 183 | foreach ($str as $var => $value) { |
| 185 | 184 | $obj->$var = clean_input($value); |
| 186 | 185 | } |
| 187 | 186 | $str = $obj; |
| 188 | - } |
|
| 189 | - else{ |
|
| 187 | + } else{ |
|
| 190 | 188 | $str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8'); |
| 191 | 189 | } |
| 192 | 190 | return $str; |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * Function to test private & protected method |
|
| 5 | - */ |
|
| 4 | + * Function to test private & protected method |
|
| 5 | + */ |
|
| 6 | 6 | function runPrivateOrProtectedMethod($object, $method, array $args = array()){ |
| 7 | 7 | $r = new ReflectionClass(get_class($object)); |
| 8 | 8 | $m = $r->getMethod($method); |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Function to test private & protected method |
| 5 | 5 | */ |
| 6 | - function runPrivateOrProtectedMethod($object, $method, array $args = array()){ |
|
| 6 | + function runPrivateOrProtectedMethod($object, $method, array $args = array()) { |
|
| 7 | 7 | $r = new ReflectionClass(get_class($object)); |
| 8 | 8 | $m = $r->getMethod($method); |
| 9 | 9 | $m->setAccessible(true); |
@@ -3,66 +3,66 @@ discard block |
||
| 3 | 3 | class FormValidationTest extends TestCase |
| 4 | 4 | { |
| 5 | 5 | public static function setUpBeforeClass() |
| 6 | - { |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | - } |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | 10 | public static function tearDownAfterClass() |
| 11 | - { |
|
| 11 | + { |
|
| 12 | 12 | |
| 13 | - } |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - protected function setUp() |
|
| 16 | - { |
|
| 15 | + protected function setUp() |
|
| 16 | + { |
|
| 17 | 17 | |
| 18 | - } |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - protected function tearDown() |
|
| 21 | - { |
|
| 20 | + protected function tearDown() |
|
| 21 | + { |
|
| 22 | 22 | |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - // tests |
|
| 28 | - public function testValidationDataIsEmpty() |
|
| 29 | - { |
|
| 27 | + // tests |
|
| 28 | + public function testValidationDataIsEmpty() |
|
| 29 | + { |
|
| 30 | 30 | $fv = new FormValidation(); |
| 31 | 31 | $this->assertEmpty($fv->getData()); |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | public function testValidationDataIsNotEmpty() |
| 35 | - { |
|
| 35 | + { |
|
| 36 | 36 | $fv = new FormValidation(); |
| 37 | 37 | $fv->setData(array('name' => 'mike')); |
| 38 | 38 | $this->assertNotEmpty($fv->getData()); |
| 39 | 39 | $this->assertArrayHasKey('name', $fv->getData()); |
| 40 | - } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | public function testCannotDoValidation() |
| 43 | - { |
|
| 43 | + { |
|
| 44 | 44 | $fv = new FormValidation(); |
| 45 | 45 | $this->assertFalse($fv->canDoValidation()); |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | public function testSettingErrorDelimiter() |
| 49 | - { |
|
| 49 | + { |
|
| 50 | 50 | $fv = new FormValidation(); |
| 51 | 51 | $fv->setErrorDelimiter('<a>', '</b>'); |
| 52 | 52 | $this->assertContains('<a>', $fv->getErrorDelimiter()); |
| 53 | 53 | $this->assertContains('</b>', $fv->getErrorDelimiter()); |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | public function testSettingErrorsDelimiter() |
| 57 | - { |
|
| 57 | + { |
|
| 58 | 58 | $fv = new FormValidation(); |
| 59 | 59 | $fv->setErrorsDelimiter('<foo>', '</bar>'); |
| 60 | 60 | $this->assertContains('<foo>', $fv->getErrorsDelimiter()); |
| 61 | 61 | $this->assertContains('</bar>', $fv->getErrorsDelimiter()); |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | public function testSettingErrorMessageOverride() |
| 65 | - { |
|
| 65 | + { |
|
| 66 | 66 | |
| 67 | 67 | //field specific message for the rule |
| 68 | 68 | $fv = new FormValidation(); |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $this->assertFalse($fv->run()); |
| 84 | 84 | $this->assertContains('global required message error', $fv->returnErrors()); |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | public function testSettingCustomErrorMessage() |
| 88 | - { |
|
| 88 | + { |
|
| 89 | 89 | |
| 90 | 90 | $fv = new FormValidation(); |
| 91 | 91 | $fv->setData(array('foo' => '')); |
@@ -103,20 +103,20 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $this->assertFalse($fv->run()); |
| 105 | 105 | $this->assertContains('custom "bar" message error', $fv->returnErrors()); |
| 106 | - } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | public function testReturnErrorsArray() |
| 109 | - { |
|
| 109 | + { |
|
| 110 | 110 | $fv = new FormValidation(); |
| 111 | 111 | $fv->setRule('name', 'name', 'required'); |
| 112 | 112 | $fv->setData(array('name' => '')); |
| 113 | 113 | $this->assertFalse($fv->run()); |
| 114 | 114 | $this->assertNotEmpty($fv->returnErrors()); |
| 115 | - } |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | public function testRequiredRule() |
| 119 | - { |
|
| 119 | + { |
|
| 120 | 120 | $fv = new FormValidation(); |
| 121 | 121 | $fv->setRule('name', 'name', 'required'); |
| 122 | 122 | $fv->setData(array('name' => '')); |
@@ -131,5 +131,5 @@ discard block |
||
| 131 | 131 | $fv->setRule('name', 'name', 'required'); |
| 132 | 132 | $fv->setData(array('name' => 'tony')); |
| 133 | 133 | $this->assertTrue($fv->run()); |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | } |
| 136 | 136 | \ No newline at end of file |
@@ -30,15 +30,15 @@ discard block |
||
| 30 | 30 | // tests |
| 31 | 31 | public function testSomeFeature() |
| 32 | 32 | { |
| 33 | - $config['driver'] = 'mysql'; |
|
| 34 | - $config['username'] = 'root'; |
|
| 35 | - $config['password'] = ''; |
|
| 36 | - $config['database'] = 'db_gesco'; |
|
| 37 | - $config['hostname'] = 'localhost:3307'; |
|
| 33 | + $config['driver'] = 'mysql'; |
|
| 34 | + $config['username'] = 'root'; |
|
| 35 | + $config['password'] = ''; |
|
| 36 | + $config['database'] = 'db_gesco'; |
|
| 37 | + $config['hostname'] = 'localhost:3307'; |
|
| 38 | 38 | $config['charset'] = 'utf8'; |
| 39 | 39 | $config['collation'] = 'utf8_general_ci'; |
| 40 | - $config['prefix'] = ''; |
|
| 41 | - $config['port'] = 3307; |
|
| 40 | + $config['prefix'] = ''; |
|
| 41 | + $config['port'] = 3307; |
|
| 42 | 42 | |
| 43 | 43 | $l = new Log(); |
| 44 | 44 | $l->setLogger('TNHBIS'); |
@@ -92,21 +92,21 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | |
| 95 | - public function testConfigChange(){ |
|
| 95 | + public function testConfigChange() { |
|
| 96 | 96 | //echo Config::get('base_url'); |
| 97 | 97 | $c = new Config(); |
| 98 | 98 | $c->set('base_url', 'foo'); |
| 99 | 99 | //echo get_config('base_url'); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function testCallPrivateProtectedMethod(){ |
|
| 102 | + public function testCallPrivateProtectedMethod() { |
|
| 103 | 103 | $c = new FileCache(); |
| 104 | 104 | $expected = CACHE_PATH . md5('foo') . '.cache'; |
| 105 | 105 | $result = runPrivateOrProtectedMethod($c, 'getFilePath', array('foo')); |
| 106 | 106 | $this->assertEquals($expected, $result); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public function testMocks(){ |
|
| 109 | + public function testMocks() { |
|
| 110 | 110 | $mock = $this->getMockBuilder('Model')->getMock(); |
| 111 | 111 | $mock->expects($this->any())->method('get')->will($this->returnValue('foobar')); |
| 112 | 112 | $this->assertEquals('foobar', $mock->get(1)); |
@@ -24,20 +24,20 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - public function testFunctionGetConfigKeyNotExist(){ |
|
| 27 | + public function testFunctionGetConfigKeyNotExist() { |
|
| 28 | 28 | $key = 'foo'; |
| 29 | 29 | $cfg = get_config($key); |
| 30 | 30 | $this->assertNull($cfg); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function testFunctionGetConfigKeyNotExistUsingDefaultValue(){ |
|
| 33 | + public function testFunctionGetConfigKeyNotExistUsingDefaultValue() { |
|
| 34 | 34 | $key = 'foo'; |
| 35 | 35 | $expected = 'bar'; |
| 36 | 36 | $cfg = get_config($key, $expected); |
| 37 | 37 | $this->assertEquals($cfg, $expected); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function testFunctionGetConfigAfterSet(){ |
|
| 40 | + public function testFunctionGetConfigAfterSet() { |
|
| 41 | 41 | $key = 'foo'; |
| 42 | 42 | $expected = 'bar'; |
| 43 | 43 | $c = new Config(); |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | $this->assertEquals($cfg, $expected); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function testVsStream(){ |
|
| 50 | + public function testVsStream() { |
|
| 51 | 51 | |
| 52 | - $vfs = vfsStream::setup('tnhfw'); |
|
| 52 | + $vfs = vfsStream::setup('tnhfw'); |
|
| 53 | 53 | $this->assertFalse($vfs->hasChild('test')); |
| 54 | 54 | mkdir(vfsStream::url('tnhfw') . DS . 'test'); |
| 55 | 55 | $this->assertTrue($vfs->hasChild('test')); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | - public function testDefaultValue(){ |
|
| 28 | + public function testDefaultValue() { |
|
| 29 | 29 | $e = new Event('foo'); |
| 30 | 30 | $this->assertSame($e->name, 'foo'); |
| 31 | 31 | $this->assertSame($e->payload, array()); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->assertFalse($e->stop); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function testPayloadValueIsSet(){ |
|
| 36 | + public function testPayloadValueIsSet() { |
|
| 37 | 37 | $e = new Event('foo', array('bar')); |
| 38 | 38 | $this->assertSame($e->name, 'foo'); |
| 39 | 39 | $this->assertSame($e->payload, array('bar')); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->assertFalse($e->stop); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function testReturnBackValueIsSetToTrue(){ |
|
| 44 | + public function testReturnBackValueIsSetToTrue() { |
|
| 45 | 45 | $e = new Event('foo', array('bar'), true); |
| 46 | 46 | $this->assertSame($e->name, 'foo'); |
| 47 | 47 | $this->assertSame($e->payload, array('bar')); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $this->assertFalse($e->stop); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function testStopValueIsSetToTue(){ |
|
| 52 | + public function testStopValueIsSetToTue() { |
|
| 53 | 53 | $e = new Event('foo', array('bar'), true, true); |
| 54 | 54 | $this->assertSame($e->name, 'foo'); |
| 55 | 55 | $this->assertSame($e->payload, array('bar')); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - public function testUsingSessionConfiguration(){ |
|
| 48 | + public function testUsingSessionConfiguration() { |
|
| 49 | 49 | $secret = 'bXlzZWNyZXQ'; |
| 50 | 50 | //using value in the configuration |
| 51 | 51 | static::$config->set('session_save_path', 'DBSessionModel'); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $this->assertEquals($dbsh->decode($encoded), 'foo'); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function testWhenDataIsExpired(){ |
|
| 75 | + public function testWhenDataIsExpired() { |
|
| 76 | 76 | $model = new DBSessionModel($this->db); |
| 77 | 77 | //to prevent old data conflict |
| 78 | 78 | $model->truncate(); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $this->assertFalse($dbsh->read('foo')); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function testWhenDataAlreadyExistDoUpdate(){ |
|
| 93 | + public function testWhenDataAlreadyExistDoUpdate() { |
|
| 94 | 94 | $model = new DBSessionModel($this->db); |
| 95 | 95 | //to prevent old data conflict |
| 96 | 96 | $model->truncate(); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $this->assertEquals($dbsh->read('foo'), '445'); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function testUsingCustomModelInstance(){ |
|
| 111 | + public function testUsingCustomModelInstance() { |
|
| 112 | 112 | |
| 113 | 113 | $model = new DBSessionModel($this->db); |
| 114 | 114 | //to prevent old data conflict |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
| 145 | - public function testUsingCustomLogInstance(){ |
|
| 145 | + public function testUsingCustomLogInstance() { |
|
| 146 | 146 | $model = new DBSessionModel($this->db); |
| 147 | 147 | //to prevent old data conflict |
| 148 | 148 | $model->truncate(); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $this->assertEquals($dbsh->decode($encoded), 'foo'); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function testUsingCustomLoaderInstance(){ |
|
| 177 | + public function testUsingCustomLoaderInstance() { |
|
| 178 | 178 | $model = new DBSessionModel($this->db); |
| 179 | 179 | //to prevent old data conflict |
| 180 | 180 | $model->truncate(); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $this->assertEquals($dbsh->decode($encoded), 'foo'); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - public function testWhenModelInsanceIsNotSet(){ |
|
| 209 | + public function testWhenModelInsanceIsNotSet() { |
|
| 210 | 210 | $model = new DBSessionModel($this->db); |
| 211 | 211 | //to prevent old data conflict |
| 212 | 212 | $model->truncate(); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $this->assertEquals($dbsh->decode($encoded), 'foo'); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - public function testWhenModelTableColumnsIsNotSet(){ |
|
| 241 | + public function testWhenModelTableColumnsIsNotSet() { |
|
| 242 | 242 | $model = new DBSessionModel($this->db); |
| 243 | 243 | //to prevent old data conflict |
| 244 | 244 | $model->truncate(); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $this->assertEquals('bar', Session::get('foo')); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function testExc(){ |
|
| 33 | + public function testExc() { |
|
| 34 | 34 | //$this->expectException(InvalidArgumentException::class); |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |