Test Failed
Push — 1.0.0-dev ( b5c6bf...f8836a )
by nguereza
04:02
created
tests/include/autoloader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
tests/include/common.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
tests/include/testsUtil.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
tests/tnhfw/CommonTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'));
Please login to merge, or discard this patch.
tests/tnhfw/classes/EventTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'));
Please login to merge, or discard this patch.
tests/tnhfw/classes/DBSessionHandlerTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
tests/tnhfw/classes/SessionTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
tests/hmvc/models/CoursModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-	class CoursModel extends Model{
2
+	class CoursModel extends Model {
3 3
 		
4 4
 		protected $_table = 'specialite';
5 5
 		protected $validate = array(
Please login to merge, or discard this patch.
tests/hmvc/models/DBSessionModel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	class DBSessionModel extends DBSessionHandlerModel{
2
+	class DBSessionModel extends DBSessionHandlerModel {
3 3
 		
4 4
 		protected $_table = 'ses';
5 5
 		protected $primary_key = 's_id';
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
 			'skey' => 'usr_id' //VARCHAR(255) 
15 15
 		);
16 16
 		
17
-		public function deleteByTime($time){
17
+		public function deleteByTime($time) {
18 18
 			$this->_database->from($this->_table)
19 19
 						->where('s_time', '<', $time)
20 20
 						->delete();
21 21
 		}
22 22
 
23 23
 		
24
-		public function getKeyValue(){
24
+		public function getKeyValue() {
25 25
 			$user_id = 0;
26 26
 			return $user_id;
27 27
 		}
Please login to merge, or discard this patch.