@@ -58,7 +58,6 @@ |
||
58 | 58 | /** |
59 | 59 | * Restored the original system timezone |
60 | 60 | * |
61 | - * @param string $timezoneIdentifier Timezone string |
|
62 | 61 | * @return void |
63 | 62 | */ |
64 | 63 | protected function _restoreSystemTimezone() { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | array( |
163 | 163 | '+2 months +2 days', |
164 | 164 | '2 months, 2 days', |
165 | - 'on ' . date('j/n/y', strtotime('+2 months +2 days')) |
|
165 | + 'on '.date('j/n/y', strtotime('+2 months +2 days')) |
|
166 | 166 | ), |
167 | 167 | array( |
168 | 168 | '+2 months +12 days', |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | strtotime('+4 months +2 weeks +3 days'), |
203 | 203 | array('absoluteString' => 'exactly on %s', 'accuracy' => array('year' => 'year'), 'end' => '+2 months') |
204 | 204 | ); |
205 | - $expected = 'exactly on ' . date('j/n/y', strtotime('+4 months +2 weeks +3 days')); |
|
205 | + $expected = 'exactly on '.date('j/n/y', strtotime('+4 months +2 weeks +3 days')); |
|
206 | 206 | $this->assertEquals($expected, $result); |
207 | 207 | } |
208 | 208 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | strtotime('+2 months +2 days'), |
285 | 285 | array('end' => '1 month', 'format' => 'Y-m-d') |
286 | 286 | ); |
287 | - $this->assertEquals('on ' . date('Y-m-d', strtotime('+2 months +2 days')), $result); |
|
287 | + $this->assertEquals('on '.date('Y-m-d', strtotime('+2 months +2 days')), $result); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | strtotime('-2 months -2 days'), |
310 | 310 | array('end' => '1 month', 'format' => 'Y-m-d') |
311 | 311 | ); |
312 | - $this->assertEquals('on ' . date('Y-m-d', strtotime('-2 months -2 days')), $result); |
|
312 | + $this->assertEquals('on '.date('Y-m-d', strtotime('-2 months -2 days')), $result); |
|
313 | 313 | |
314 | 314 | $result = $this->Time->timeAgoInWords( |
315 | 315 | strtotime('-2 years -5 months -2 days'), |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | $time = strtotime('-3 years -12 months'); |
327 | 327 | $result = $this->Time->timeAgoInWords($time); |
328 | - $expected = 'on ' . date('j/n/y', $time); |
|
328 | + $expected = 'on '.date('j/n/y', $time); |
|
329 | 329 | $this->assertEquals($expected, $result); |
330 | 330 | |
331 | 331 | $result = $this->Time->timeAgoInWords( |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $timestamp, |
340 | 340 | array('accuracy' => array('year' => 'year')) |
341 | 341 | ); |
342 | - $expected = 'on ' . date('j/n/y', $timestamp); |
|
342 | + $expected = 'on '.date('j/n/y', $timestamp); |
|
343 | 343 | $this->assertEquals($expected, $result); |
344 | 344 | |
345 | 345 | $result = $this->Time->timeAgoInWords( |
@@ -409,16 +409,16 @@ discard block |
||
409 | 409 | */ |
410 | 410 | public function testNiceShort() { |
411 | 411 | $time = time(); |
412 | - $this->assertEquals('Today, ' . date('H:i', $time), $this->Time->niceShort($time)); |
|
412 | + $this->assertEquals('Today, '.date('H:i', $time), $this->Time->niceShort($time)); |
|
413 | 413 | |
414 | 414 | $time = time() - DAY; |
415 | - $this->assertEquals('Yesterday, ' . date('H:i', $time), $this->Time->niceShort($time)); |
|
415 | + $this->assertEquals('Yesterday, '.date('H:i', $time), $this->Time->niceShort($time)); |
|
416 | 416 | |
417 | 417 | $time = time() + DAY; |
418 | - $this->assertEquals('Tomorrow, ' . date('H:i', $time), $this->Time->niceShort($time)); |
|
418 | + $this->assertEquals('Tomorrow, '.date('H:i', $time), $this->Time->niceShort($time)); |
|
419 | 419 | |
420 | 420 | $time = strtotime('+6 days'); |
421 | - $this->assertEquals('On ' . date('l F d, H:i', $time), $this->Time->niceShort($time)); |
|
421 | + $this->assertEquals('On '.date('l F d, H:i', $time), $this->Time->niceShort($time)); |
|
422 | 422 | |
423 | 423 | $time = strtotime('-6 days'); |
424 | 424 | $this->assertEquals(date('l F d, H:i', $time), $this->Time->niceShort($time)); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $begin = time(); |
445 | 445 | $end = time() + DAY; |
446 | 446 | $field = 'my_field'; |
447 | - $expected = '(my_field >= \'' . date('Y-m-d', $begin) . ' 00:00:00\') AND (my_field <= \'' . date('Y-m-d', $end) . ' 23:59:59\')'; |
|
447 | + $expected = '(my_field >= \''.date('Y-m-d', $begin).' 00:00:00\') AND (my_field <= \''.date('Y-m-d', $end).' 23:59:59\')'; |
|
448 | 448 | $this->assertEquals($expected, $this->Time->daysAsSql($begin, $end, $field)); |
449 | 449 | } |
450 | 450 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | public function testDayAsSql() { |
457 | 457 | $time = time(); |
458 | 458 | $field = 'my_field'; |
459 | - $expected = '(my_field >= \'' . date('Y-m-d', $time) . ' 00:00:00\') AND (my_field <= \'' . date('Y-m-d', $time) . ' 23:59:59\')'; |
|
459 | + $expected = '(my_field >= \''.date('Y-m-d', $time).' 00:00:00\') AND (my_field <= \''.date('Y-m-d', $time).' 23:59:59\')'; |
|
460 | 460 | $this->assertEquals($expected, $this->Time->dayAsSql($time, $field)); |
461 | 461 | } |
462 | 462 | |
@@ -698,10 +698,10 @@ discard block |
||
698 | 698 | $days = $map[date('D')]; |
699 | 699 | |
700 | 700 | for ($day = $days[0] + 1; $day < $days[1]; $day++) { |
701 | - $this->assertTrue($this->Time->isThisWeek(($day > 0 ? '+' : '') . $day . ' days')); |
|
701 | + $this->assertTrue($this->Time->isThisWeek(($day > 0 ? '+' : '').$day.' days')); |
|
702 | 702 | } |
703 | - $this->assertFalse($this->Time->isThisWeek($days[0] . ' days')); |
|
704 | - $this->assertFalse($this->Time->isThisWeek('+' . $days[1] . ' days')); |
|
703 | + $this->assertFalse($this->Time->isThisWeek($days[0].' days')); |
|
704 | + $this->assertFalse($this->Time->isThisWeek('+'.$days[1].' days')); |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | /** |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | */ |
968 | 968 | public function testConvertSpecifiers() { |
969 | 969 | App::build(array( |
970 | - 'Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS) |
|
970 | + 'Locale' => array(CAKE.'Test'.DS.'test_app'.DS.'Locale'.DS) |
|
971 | 971 | ), App::RESET); |
972 | 972 | Configure::write('Config.language', 'time_test'); |
973 | 973 | $time = strtotime('Thu Jan 14 11:43:39 2010'); |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | */ |
1075 | 1075 | public function testI18nFormat() { |
1076 | 1076 | App::build(array( |
1077 | - 'Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS) |
|
1077 | + 'Locale' => array(CAKE.'Test'.DS.'test_app'.DS.'Locale'.DS) |
|
1078 | 1078 | ), App::RESET); |
1079 | 1079 | Configure::write('Config.language', 'time_test'); |
1080 | 1080 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | $this->assertEquals($expected, $result); |
1086 | 1086 | |
1087 | 1087 | $result = $this->Time->i18nFormat($time, '%c'); |
1088 | - $expected = 'jue 14 ene 2010 13:59:28 ' . utf8_encode(strftime('%Z', $time)); |
|
1088 | + $expected = 'jue 14 ene 2010 13:59:28 '.utf8_encode(strftime('%Z', $time)); |
|
1089 | 1089 | $this->assertEquals($expected, $result); |
1090 | 1090 | |
1091 | 1091 | $result = $this->Time->i18nFormat($time, 'Time is %r, and date is %x'); |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | $this->assertEquals($expected, $result); |
1100 | 1100 | |
1101 | 1101 | $result = $this->Time->i18nFormat($time, '%c'); |
1102 | - $expected = 'mié 13 ene 2010 13:59:28 ' . utf8_encode(strftime('%Z', $time)); |
|
1102 | + $expected = 'mié 13 ene 2010 13:59:28 '.utf8_encode(strftime('%Z', $time)); |
|
1103 | 1103 | $this->assertEquals($expected, $result); |
1104 | 1104 | |
1105 | 1105 | $result = $this->Time->i18nFormat($time, 'Time is %r, and date is %x'); |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | $this->assertTrue(isset($return['America/Argentina/Buenos_Aires'])); |
1146 | 1146 | $this->assertTrue(isset($return['Pacific/Tahiti'])); |
1147 | 1147 | |
1148 | - if (!$this->skipIf(version_compare(PHP_VERSION, '5.3.0', '<'))) { |
|
1148 | + if ( ! $this->skipIf(version_compare(PHP_VERSION, '5.3.0', '<'))) { |
|
1149 | 1149 | $return = CakeTime::listTimezones(DateTimeZone::ASIA); |
1150 | 1150 | $this->assertTrue(isset($return['Asia']['Asia/Bangkok'])); |
1151 | 1151 | $this->assertFalse(isset($return['Pacific'])); |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | /** |
392 | 392 | * testWrite method |
393 | 393 | * |
394 | - * @return void |
|
394 | + * @return false|null |
|
395 | 395 | */ |
396 | 396 | public function testWrite() { |
397 | 397 | if (!$tmpFile = $this->_getTmpFile()) { |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | /** |
422 | 422 | * testAppend method |
423 | 423 | * |
424 | - * @return void |
|
424 | + * @return false|null |
|
425 | 425 | */ |
426 | 426 | public function testAppend() { |
427 | 427 | if (!$tmpFile = $this->_getTmpFile()) { |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * testDelete method |
459 | 459 | * |
460 | - * @return void |
|
460 | + * @return false|null |
|
461 | 461 | */ |
462 | 462 | public function testDelete() { |
463 | 463 | if (!$tmpFile = $this->_getTmpFile()) { |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * Windows has issues unlinking files if there are |
483 | 483 | * active filehandles open. |
484 | 484 | * |
485 | - * @return void |
|
485 | + * @return false|null |
|
486 | 486 | */ |
487 | 487 | public function testDeleteAfterRead() { |
488 | 488 | if (!$tmpFile = $this->_getTmpFile()) { |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * getTmpFile method |
545 | 545 | * |
546 | 546 | * @param boolean $paintSkip |
547 | - * @return void |
|
547 | + * @return string|false |
|
548 | 548 | */ |
549 | 549 | protected function _getTmpFile($paintSkip = true) { |
550 | 550 | $tmpFile = TMP . 'tests' . DS . 'cakephp.file.test.tmp'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | unset($this->File); |
56 | 56 | |
57 | 57 | $Folder = new Folder(); |
58 | - $Folder->delete(TMP . 'tests' . DS . 'permissions'); |
|
58 | + $Folder->delete(TMP.'tests'.DS.'permissions'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public function testBasic() { |
67 | - $file = CAKE . DS . 'LICENSE.txt'; |
|
67 | + $file = CAKE.DS.'LICENSE.txt'; |
|
68 | 68 | |
69 | 69 | $this->File = new File($file, false); |
70 | 70 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | 'mime' => 'text/plain' |
83 | 83 | ); |
84 | 84 | if ( |
85 | - !function_exists('finfo_open') && |
|
86 | - (!function_exists('mime_content_type') || |
|
85 | + ! function_exists('finfo_open') && |
|
86 | + ( ! function_exists('mime_content_type') || |
|
87 | 87 | function_exists('mime_content_type') && |
88 | 88 | mime_content_type($this->File->pwd()) === false) |
89 | 89 | ) { |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | public function testPermission() { |
132 | 132 | $this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows.'); |
133 | 133 | |
134 | - $dir = TMP . 'tests' . DS . 'permissions' . DS; |
|
134 | + $dir = TMP.'tests'.DS.'permissions'.DS; |
|
135 | 135 | $old = umask(); |
136 | 136 | |
137 | 137 | umask(0002); |
138 | - $file = $dir . 'permission_' . uniqid(); |
|
138 | + $file = $dir.'permission_'.uniqid(); |
|
139 | 139 | $expecting = decoct(0664 & ~umask()); |
140 | 140 | $File = new File($file, true); |
141 | 141 | $result = $File->perms(); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $File->delete(); |
144 | 144 | |
145 | 145 | umask(0022); |
146 | - $file = $dir . 'permission_' . uniqid(); |
|
146 | + $file = $dir.'permission_'.uniqid(); |
|
147 | 147 | $expecting = decoct(0644 & ~umask()); |
148 | 148 | $File = new File($file, true); |
149 | 149 | $result = $File->perms(); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $File->delete(); |
152 | 152 | |
153 | 153 | umask(0422); |
154 | - $file = $dir . 'permission_' . uniqid(); |
|
154 | + $file = $dir.'permission_'.uniqid(); |
|
155 | 155 | $expecting = decoct(0244 & ~umask()); |
156 | 156 | $File = new File($file, true); |
157 | 157 | $result = $File->perms(); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $File->delete(); |
160 | 160 | |
161 | 161 | umask(0444); |
162 | - $file = $dir . 'permission_' . uniqid(); |
|
162 | + $file = $dir.'permission_'.uniqid(); |
|
163 | 163 | $expecting = decoct(0222 & ~umask()); |
164 | 164 | $File = new File($file, true); |
165 | 165 | $result = $File->perms(); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $result = $this->File->read(); |
182 | 182 | $expecting = file_get_contents(__FILE__); |
183 | 183 | $this->assertEquals($expecting, $result); |
184 | - $this->assertTrue(!is_resource($this->File->handle)); |
|
184 | + $this->assertTrue( ! is_resource($this->File->handle)); |
|
185 | 185 | |
186 | 186 | $this->File->lock = true; |
187 | 187 | $result = $this->File->read(); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @return void |
280 | 280 | */ |
281 | 281 | public function testCreate() { |
282 | - $tmpFile = TMP . 'tests' . DS . 'cakephp.file.test.tmp'; |
|
282 | + $tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp'; |
|
283 | 283 | $File = new File($tmpFile, true, 0777); |
284 | 284 | $this->assertTrue($File->exists()); |
285 | 285 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @return void |
291 | 291 | */ |
292 | 292 | public function testOpeningNonExistentFileCreatesIt() { |
293 | - $someFile = new File(TMP . 'some_file.txt', false); |
|
293 | + $someFile = new File(TMP.'some_file.txt', false); |
|
294 | 294 | $this->assertTrue($someFile->open()); |
295 | 295 | $this->assertEquals('', $someFile->read()); |
296 | 296 | $someFile->close(); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @return void |
324 | 324 | */ |
325 | 325 | public function testReadable() { |
326 | - $someFile = new File(TMP . 'some_file.txt', false); |
|
326 | + $someFile = new File(TMP.'some_file.txt', false); |
|
327 | 327 | $this->assertTrue($someFile->open()); |
328 | 328 | $this->assertTrue($someFile->readable()); |
329 | 329 | $someFile->close(); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * @return void |
337 | 337 | */ |
338 | 338 | public function testWritable() { |
339 | - $someFile = new File(TMP . 'some_file.txt', false); |
|
339 | + $someFile = new File(TMP.'some_file.txt', false); |
|
340 | 340 | $this->assertTrue($someFile->open()); |
341 | 341 | $this->assertTrue($someFile->writable()); |
342 | 342 | $someFile->close(); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * @return void |
350 | 350 | */ |
351 | 351 | public function testExecutable() { |
352 | - $someFile = new File(TMP . 'some_file.txt', false); |
|
352 | + $someFile = new File(TMP.'some_file.txt', false); |
|
353 | 353 | $this->assertTrue($someFile->open()); |
354 | 354 | $this->assertFalse($someFile->executable()); |
355 | 355 | $someFile->close(); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @return void |
363 | 363 | */ |
364 | 364 | public function testLastAccess() { |
365 | - $someFile = new File(TMP . 'some_file.txt', false); |
|
365 | + $someFile = new File(TMP.'some_file.txt', false); |
|
366 | 366 | $this->assertFalse($someFile->lastAccess()); |
367 | 367 | $this->assertTrue($someFile->open()); |
368 | 368 | $this->assertWithinMargin($someFile->lastAccess(), time(), 2); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @return void |
377 | 377 | */ |
378 | 378 | public function testLastChange() { |
379 | - $someFile = new File(TMP . 'some_file.txt', false); |
|
379 | + $someFile = new File(TMP.'some_file.txt', false); |
|
380 | 380 | $this->assertFalse($someFile->lastChange()); |
381 | 381 | $this->assertTrue($someFile->open('r+')); |
382 | 382 | $this->assertWithinMargin($someFile->lastChange(), time(), 2); |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * @return void |
395 | 395 | */ |
396 | 396 | public function testWrite() { |
397 | - if (!$tmpFile = $this->_getTmpFile()) { |
|
397 | + if ( ! $tmpFile = $this->_getTmpFile()) { |
|
398 | 398 | return false; |
399 | 399 | } |
400 | 400 | if (file_exists($tmpFile)) { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @return void |
425 | 425 | */ |
426 | 426 | public function testAppend() { |
427 | - if (!$tmpFile = $this->_getTmpFile()) { |
|
427 | + if ( ! $tmpFile = $this->_getTmpFile()) { |
|
428 | 428 | return false; |
429 | 429 | } |
430 | 430 | if (file_exists($tmpFile)) { |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $r = $TmpFile->append($fragment); |
442 | 442 | $this->assertTrue($r); |
443 | 443 | $this->assertTrue(file_exists($tmpFile)); |
444 | - $data = $data . $fragment; |
|
444 | + $data = $data.$fragment; |
|
445 | 445 | $this->assertEquals($data, file_get_contents($tmpFile)); |
446 | 446 | $newSize = $TmpFile->size(); |
447 | 447 | $this->assertTrue($newSize > $size); |
@@ -460,11 +460,11 @@ discard block |
||
460 | 460 | * @return void |
461 | 461 | */ |
462 | 462 | public function testDelete() { |
463 | - if (!$tmpFile = $this->_getTmpFile()) { |
|
463 | + if ( ! $tmpFile = $this->_getTmpFile()) { |
|
464 | 464 | return false; |
465 | 465 | } |
466 | 466 | |
467 | - if (!file_exists($tmpFile)) { |
|
467 | + if ( ! file_exists($tmpFile)) { |
|
468 | 468 | touch($tmpFile); |
469 | 469 | } |
470 | 470 | $TmpFile = new File($tmpFile); |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | * @return void |
486 | 486 | */ |
487 | 487 | public function testDeleteAfterRead() { |
488 | - if (!$tmpFile = $this->_getTmpFile()) { |
|
488 | + if ( ! $tmpFile = $this->_getTmpFile()) { |
|
489 | 489 | return false; |
490 | 490 | } |
491 | - if (!file_exists($tmpFile)) { |
|
491 | + if ( ! file_exists($tmpFile)) { |
|
492 | 492 | touch($tmpFile); |
493 | 493 | } |
494 | 494 | $File = new File($tmpFile); |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @return void |
503 | 503 | */ |
504 | 504 | public function testCopy() { |
505 | - $dest = TMP . 'tests' . DS . 'cakephp.file.test.tmp'; |
|
505 | + $dest = TMP.'tests'.DS.'cakephp.file.test.tmp'; |
|
506 | 506 | $file = __FILE__; |
507 | 507 | $this->File = new File($file); |
508 | 508 | $result = $this->File->copy($dest); |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | * @return void |
531 | 531 | */ |
532 | 532 | public function testMime() { |
533 | - $this->skipIf(!function_exists('finfo_open') && !function_exists('mime_content_type'), 'Not able to read mime type'); |
|
534 | - $path = CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS . 'img' . DS . 'cake.power.gif'; |
|
533 | + $this->skipIf( ! function_exists('finfo_open') && ! function_exists('mime_content_type'), 'Not able to read mime type'); |
|
534 | + $path = CAKE.'Test'.DS.'test_app'.DS.'webroot'.DS.'img'.DS.'cake.power.gif'; |
|
535 | 535 | $file = new File($path); |
536 | 536 | $expected = 'image/gif'; |
537 | 537 | if (function_exists('mime_content_type') && mime_content_type($file->pwd()) === false) { |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | * @return void |
548 | 548 | */ |
549 | 549 | protected function _getTmpFile($paintSkip = true) { |
550 | - $tmpFile = TMP . 'tests' . DS . 'cakephp.file.test.tmp'; |
|
551 | - if (is_writable(dirname($tmpFile)) && (!file_exists($tmpFile) || is_writable($tmpFile))) { |
|
550 | + $tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp'; |
|
551 | + if (is_writable(dirname($tmpFile)) && ( ! file_exists($tmpFile) || is_writable($tmpFile))) { |
|
552 | 552 | return $tmpFile; |
553 | 553 | } |
554 | 554 |
@@ -28,7 +28,6 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * Makes sure that a given $email address is valid and unique |
30 | 30 | * |
31 | - * @param string $email |
|
32 | 31 | * @return boolean |
33 | 32 | */ |
34 | 33 | public static function customValidate($check) { |
@@ -50,7 +49,7 @@ discard block |
||
50 | 49 | * postal function, for testing postal pass through. |
51 | 50 | * |
52 | 51 | * @param string $check |
53 | - * @return void |
|
52 | + * @return boolean |
|
54 | 53 | */ |
55 | 54 | public static function postal($check) { |
56 | 55 | return true; |
@@ -59,7 +58,7 @@ discard block |
||
59 | 58 | /** |
60 | 59 | * ssn function for testing ssn pass through |
61 | 60 | * |
62 | - * @return void |
|
61 | + * @return boolean |
|
63 | 62 | */ |
64 | 63 | public static function ssn($check) { |
65 | 64 | return true; |
@@ -80,7 +79,7 @@ discard block |
||
80 | 79 | * phone function, for testing phone pass through. |
81 | 80 | * |
82 | 81 | * @param string $check |
83 | - * @return void |
|
82 | + * @return boolean |
|
84 | 83 | */ |
85 | 84 | public static function phone($check) { |
86 | 85 | return true; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return boolean |
33 | 33 | */ |
34 | 34 | public static function customValidate($check) { |
35 | - return (bool)preg_match('/^[0-9]{3}$/', $check); |
|
35 | + return (bool) preg_match('/^[0-9]{3}$/', $check); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function testNotEmpty() { |
132 | 132 | $this->assertTrue(Validation::notEmpty('abcdefg')); |
133 | 133 | $this->assertTrue(Validation::notEmpty('fasdf ')); |
134 | - $this->assertTrue(Validation::notEmpty('fooo' . chr(243) . 'blabla')); |
|
134 | + $this->assertTrue(Validation::notEmpty('fooo'.chr(243).'blabla')); |
|
135 | 135 | $this->assertTrue(Validation::notEmpty('abçďĕʑʘπй')); |
136 | 136 | $this->assertTrue(Validation::notEmpty('José')); |
137 | 137 | $this->assertTrue(Validation::notEmpty('é')); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | Configure::write('App.encoding', 'ISO-8859-1'); |
150 | 150 | $this->assertTrue(Validation::notEmpty('abcdefg')); |
151 | 151 | $this->assertTrue(Validation::notEmpty('fasdf ')); |
152 | - $this->assertTrue(Validation::notEmpty('fooo' . chr(243) . 'blabla')); |
|
152 | + $this->assertTrue(Validation::notEmpty('fooo'.chr(243).'blabla')); |
|
153 | 153 | $this->assertTrue(Validation::notEmpty('abçďĕʑʘπй')); |
154 | 154 | $this->assertTrue(Validation::notEmpty('José')); |
155 | 155 | $this->assertTrue(Validation::notEmpty(utf8_decode('José'))); |
@@ -1554,9 +1554,9 @@ discard block |
||
1554 | 1554 | $this->assertTrue(Validation::decimal('1234', null)); |
1555 | 1555 | $this->assertTrue(Validation::decimal('-1234', null)); |
1556 | 1556 | $this->assertTrue(Validation::decimal('+1234', null)); |
1557 | - $this->assertTrue(Validation::decimal((float)1234, null)); |
|
1558 | - $this->assertTrue(Validation::decimal((double)1234, null)); |
|
1559 | - $this->assertTrue(Validation::decimal((int)1234, null)); |
|
1557 | + $this->assertTrue(Validation::decimal((float) 1234, null)); |
|
1558 | + $this->assertTrue(Validation::decimal((double) 1234, null)); |
|
1559 | + $this->assertTrue(Validation::decimal((int) 1234, null)); |
|
1560 | 1560 | |
1561 | 1561 | $this->assertFalse(Validation::decimal('', null)); |
1562 | 1562 | $this->assertFalse(Validation::decimal('string', null)); |
@@ -1584,13 +1584,13 @@ discard block |
||
1584 | 1584 | $this->assertTrue(Validation::decimal('.00', true)); |
1585 | 1585 | $this->assertTrue(Validation::decimal(.01, true)); |
1586 | 1586 | $this->assertTrue(Validation::decimal('.01', true)); |
1587 | - $this->assertTrue(Validation::decimal((float)1234, true)); |
|
1588 | - $this->assertTrue(Validation::decimal((double)1234, true)); |
|
1587 | + $this->assertTrue(Validation::decimal((float) 1234, true)); |
|
1588 | + $this->assertTrue(Validation::decimal((double) 1234, true)); |
|
1589 | 1589 | |
1590 | 1590 | $this->assertFalse(Validation::decimal('', true)); |
1591 | 1591 | $this->assertFalse(Validation::decimal('string', true)); |
1592 | 1592 | $this->assertFalse(Validation::decimal('1234.', true)); |
1593 | - $this->assertFalse(Validation::decimal((int)1234, true)); |
|
1593 | + $this->assertFalse(Validation::decimal((int) 1234, true)); |
|
1594 | 1594 | $this->assertFalse(Validation::decimal('1234', true)); |
1595 | 1595 | $this->assertFalse(Validation::decimal('-1234', true)); |
1596 | 1596 | $this->assertFalse(Validation::decimal('+1234', true)); |
@@ -1624,9 +1624,9 @@ discard block |
||
1624 | 1624 | $this->assertFalse(Validation::decimal('1234.', 1)); |
1625 | 1625 | $this->assertFalse(Validation::decimal(.0, 1)); |
1626 | 1626 | $this->assertFalse(Validation::decimal(.00, 2)); |
1627 | - $this->assertFalse(Validation::decimal((float)1234, 1)); |
|
1628 | - $this->assertFalse(Validation::decimal((double)1234, 1)); |
|
1629 | - $this->assertFalse(Validation::decimal((int)1234, 1)); |
|
1627 | + $this->assertFalse(Validation::decimal((float) 1234, 1)); |
|
1628 | + $this->assertFalse(Validation::decimal((double) 1234, 1)); |
|
1629 | + $this->assertFalse(Validation::decimal((int) 1234, 1)); |
|
1630 | 1630 | $this->assertFalse(Validation::decimal('1234.5678', '3')); |
1631 | 1631 | $this->assertFalse(Validation::decimal(1234.5678, 3)); |
1632 | 1632 | $this->assertFalse(Validation::decimal(-1234.5678, 3)); |
@@ -1640,8 +1640,8 @@ discard block |
||
1640 | 1640 | */ |
1641 | 1641 | public function testDecimalWithInvalidPlaces() { |
1642 | 1642 | $this->assertFalse(Validation::decimal('.27', 'string')); |
1643 | - $this->assertFalse(Validation::decimal(1234.5678, (array)true)); |
|
1644 | - $this->assertFalse(Validation::decimal(-1234.5678, (object)true)); |
|
1643 | + $this->assertFalse(Validation::decimal(1234.5678, (array) true)); |
|
1644 | + $this->assertFalse(Validation::decimal(-1234.5678, (object) true)); |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | /** |
@@ -2356,9 +2356,9 @@ discard block |
||
2356 | 2356 | * @return void |
2357 | 2357 | */ |
2358 | 2358 | public function testMimeType() { |
2359 | - $image = CORE_PATH . 'Cake' . DS . 'Test' . DS . 'test_app' . DS . 'webroot' . DS . 'img' . DS . 'cake.power.gif'; |
|
2359 | + $image = CORE_PATH.'Cake'.DS.'Test'.DS.'test_app'.DS.'webroot'.DS.'img'.DS.'cake.power.gif'; |
|
2360 | 2360 | $File = new File($image, false); |
2361 | - $this->skipIf(!$File->mime(), 'Cannot determine mimeType'); |
|
2361 | + $this->skipIf( ! $File->mime(), 'Cannot determine mimeType'); |
|
2362 | 2362 | $this->assertTrue(Validation::mimeType($image, array('image/gif'))); |
2363 | 2363 | $this->assertTrue(Validation::mimeType(array('tmp_name' => $image), array('image/gif'))); |
2364 | 2364 | |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | * @return void |
2374 | 2374 | */ |
2375 | 2375 | public function testMimeTypeFalse() { |
2376 | - $image = CORE_PATH . 'Cake' . DS . 'Test' . DS . 'test_app' . DS . 'webroot' . DS . 'img' . DS . 'cake.power.gif'; |
|
2376 | + $image = CORE_PATH.'Cake'.DS.'Test'.DS.'test_app'.DS.'webroot'.DS.'img'.DS.'cake.power.gif'; |
|
2377 | 2377 | $File = new File($image, false); |
2378 | 2378 | $this->skipIf($File->mime(), 'mimeType can be determined, no Exception will be thrown'); |
2379 | 2379 | Validation::mimeType($image, array('image/gif')); |
@@ -2400,7 +2400,7 @@ discard block |
||
2400 | 2400 | * @return void |
2401 | 2401 | */ |
2402 | 2402 | public function testFileSize() { |
2403 | - $image = CORE_PATH . 'Cake' . DS . 'Test' . DS . 'test_app' . DS . 'webroot' . DS . 'img' . DS . 'cake.power.gif'; |
|
2403 | + $image = CORE_PATH.'Cake'.DS.'Test'.DS.'test_app'.DS.'webroot'.DS.'img'.DS.'cake.power.gif'; |
|
2404 | 2404 | $this->assertTrue(Validation::fileSize($image, '<', 1024)); |
2405 | 2405 | $this->assertTrue(Validation::fileSize(array('tmp_name' => $image), 'isless', 1024)); |
2406 | 2406 | $this->assertTrue(Validation::fileSize($image, '<', '1KB')); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | /** |
311 | 311 | * beforeValidate method |
312 | 312 | * |
313 | - * @return void |
|
313 | + * @return boolean |
|
314 | 314 | */ |
315 | 315 | public function beforeValidate($options = array()) { |
316 | 316 | $this->invalidate('openid_not_registered'); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | /** |
360 | 360 | * beforeValidate method |
361 | 361 | * |
362 | - * @return void |
|
362 | + * @return boolean |
|
363 | 363 | */ |
364 | 364 | public function beforeValidate($options = array()) { |
365 | 365 | $this->invalidate('email'); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | /** |
418 | 418 | * beforeValidate method |
419 | 419 | * |
420 | - * @return void |
|
420 | + * @return boolean |
|
421 | 421 | */ |
422 | 422 | public function beforeValidate($options = array()) { |
423 | 423 | $this->invalidate('full_name'); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | /** |
468 | 468 | * beforeValidate method |
469 | 469 | * |
470 | - * @return void |
|
470 | + * @return boolean |
|
471 | 471 | */ |
472 | 472 | public function beforeValidate($options = array()) { |
473 | 473 | $this->invalidate('description'); |
@@ -690,8 +690,8 @@ discard block |
||
690 | 690 | $this->Form->request['_Token'] = array('key' => $key); |
691 | 691 | $result = $this->Form->secure($fields); |
692 | 692 | |
693 | - $hash = Security::hash(serialize($fields) . Configure::read('Security.salt')); |
|
694 | - $hash .= ':' . 'Model.valid'; |
|
693 | + $hash = Security::hash(serialize($fields).Configure::read('Security.salt')); |
|
694 | + $hash .= ':'.'Model.valid'; |
|
695 | 695 | $hash = urlencode($hash); |
696 | 696 | |
697 | 697 | $expected = array( |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | ); |
709 | 709 | $this->assertTags($result, $expected); |
710 | 710 | |
711 | - $path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS; |
|
711 | + $path = CAKE.'Test'.DS.'test_app'.DS.'Config'.DS; |
|
712 | 712 | $this->Form->Html->loadConfig('htmlhelper_tags', $path); |
713 | 713 | $result = $this->Form->secure($fields); |
714 | 714 | $expected = array( |
@@ -2286,7 +2286,7 @@ discard block |
||
2286 | 2286 | |
2287 | 2287 | $result = $this->Form->input('published', array('type' => 'time')); |
2288 | 2288 | $now = strtotime('now'); |
2289 | - $this->assertContains('<option value="' . date('h', $now) . '" selected="selected">' . date('g', $now) . '</option>', $result); |
|
2289 | + $this->assertContains('<option value="'.date('h', $now).'" selected="selected">'.date('g', $now).'</option>', $result); |
|
2290 | 2290 | |
2291 | 2291 | $now = strtotime('2013-03-09 00:42:21'); |
2292 | 2292 | $result = $this->Form->input('published', array('type' => 'time', 'selected' => $now)); |
@@ -3236,7 +3236,7 @@ discard block |
||
3236 | 3236 | public function testInputsPluginModel() { |
3237 | 3237 | $this->loadFixtures('Post'); |
3238 | 3238 | App::build(array( |
3239 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
3239 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
3240 | 3240 | )); |
3241 | 3241 | CakePlugin::load('TestPlugin'); |
3242 | 3242 | $this->Form->request['models'] = array( |
@@ -5387,7 +5387,7 @@ discard block |
||
5387 | 5387 | |
5388 | 5388 | $result = $this->Form->secure($this->Form->fields); |
5389 | 5389 | $key = 'f7d573650a295b94e0938d32b323fde775e5f32b%3A'; |
5390 | - $this->assertRegExp('/"' . $key . '"/', $result); |
|
5390 | + $this->assertRegExp('/"'.$key.'"/', $result); |
|
5391 | 5391 | } |
5392 | 5392 | |
5393 | 5393 | /** |
@@ -6109,7 +6109,7 @@ discard block |
||
6109 | 6109 | $this->assertTags($result, $expected); |
6110 | 6110 | $this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result); |
6111 | 6111 | |
6112 | - $this->Form->request->data['Model']['field'] = date('Y') . '-01-01 00:00:00'; |
|
6112 | + $this->Form->request->data['Model']['field'] = date('Y').'-01-01 00:00:00'; |
|
6113 | 6113 | $now = strtotime($this->Form->data['Model']['field']); |
6114 | 6114 | $result = $this->Form->dateTime('Model.field', 'DMY', '12', array('empty' => false)); |
6115 | 6115 | $expected = array( |
@@ -6929,7 +6929,7 @@ discard block |
||
6929 | 6929 | $result = $this->Form->hour('Model.field', true, array('value' => 'now')); |
6930 | 6930 | $thisHour = date('H'); |
6931 | 6931 | $optValue = date('G'); |
6932 | - $this->assertRegExp('/<option value="' . $thisHour . '" selected="selected">' . $optValue . '<\/option>/', $result); |
|
6932 | + $this->assertRegExp('/<option value="'.$thisHour.'" selected="selected">'.$optValue.'<\/option>/', $result); |
|
6933 | 6933 | |
6934 | 6934 | $this->Form->request->data['Model']['field'] = '2050-10-10 01:12:32'; |
6935 | 6935 | $result = $this->Form->hour('Model.field', true); |
@@ -7227,7 +7227,7 @@ discard block |
||
7227 | 7227 | 'maxYear' => 2008 |
7228 | 7228 | ) |
7229 | 7229 | ); |
7230 | - $this->assertContains('value="' . date('m') . '" selected="selected"', $result); |
|
7230 | + $this->assertContains('value="'.date('m').'" selected="selected"', $result); |
|
7231 | 7231 | $this->assertNotContains('value="2008" selected="selected"', $result); |
7232 | 7232 | |
7233 | 7233 | $result = $this->Form->input('just_year', |
@@ -7239,7 +7239,7 @@ discard block |
||
7239 | 7239 | 'maxYear' => date('Y', strtotime('+20 years')) |
7240 | 7240 | ) |
7241 | 7241 | ); |
7242 | - $this->assertNotContains('value="' . date('Y') . '" selected="selected"', $result); |
|
7242 | + $this->assertNotContains('value="'.date('Y').'" selected="selected"', $result); |
|
7243 | 7243 | |
7244 | 7244 | $result = $this->Form->input('just_month', |
7245 | 7245 | array( |
@@ -7249,7 +7249,7 @@ discard block |
||
7249 | 7249 | 'empty' => false, |
7250 | 7250 | ) |
7251 | 7251 | ); |
7252 | - $this->assertNotContains('value="' . date('m') . '" selected="selected"', $result); |
|
7252 | + $this->assertNotContains('value="'.date('m').'" selected="selected"', $result); |
|
7253 | 7253 | |
7254 | 7254 | $result = $this->Form->input('just_day', |
7255 | 7255 | array( |
@@ -7259,7 +7259,7 @@ discard block |
||
7259 | 7259 | 'empty' => false, |
7260 | 7260 | ) |
7261 | 7261 | ); |
7262 | - $this->assertNotContains('value="' . date('d') . '" selected="selected"', $result); |
|
7262 | + $this->assertNotContains('value="'.date('d').'" selected="selected"', $result); |
|
7263 | 7263 | } |
7264 | 7264 | |
7265 | 7265 | /** |
@@ -7623,9 +7623,9 @@ discard block |
||
7623 | 7623 | */ |
7624 | 7624 | public function testPostLinkSecurityHash() { |
7625 | 7625 | $hash = Security::hash( |
7626 | - '/posts/delete/1' . |
|
7627 | - serialize(array()) . |
|
7628 | - '' . |
|
7626 | + '/posts/delete/1'. |
|
7627 | + serialize(array()). |
|
7628 | + ''. |
|
7629 | 7629 | Configure::read('Security.salt') |
7630 | 7630 | ); |
7631 | 7631 | $hash .= '%3A'; |
@@ -9636,7 +9636,7 @@ discard block |
||
9636 | 9636 | public function testIntrospectModelFromRequest() { |
9637 | 9637 | $this->loadFixtures('Post'); |
9638 | 9638 | App::build(array( |
9639 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
9639 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
9640 | 9640 | )); |
9641 | 9641 | CakePlugin::load('TestPlugin'); |
9642 | 9642 | $this->Form->request['models'] = array('TestPluginPost' => array('plugin' => 'TestPlugin', 'className' => 'TestPluginPost')); |
@@ -5408,11 +5408,11 @@ |
||
5408 | 5408 | $this->assertEquals(array('Model.select'), $this->Form->fields); |
5409 | 5409 | } |
5410 | 5410 | /** |
5411 | - * When a select box has no options it should not be added to the fields list |
|
5412 | - * as it always fail post validation. |
|
5413 | - * |
|
5414 | - * @return void |
|
5415 | - */ |
|
5411 | + * When a select box has no options it should not be added to the fields list |
|
5412 | + * as it always fail post validation. |
|
5413 | + * |
|
5414 | + * @return void |
|
5415 | + */ |
|
5416 | 5416 | public function testSelectNoSecureWithNoOptions() { |
5417 | 5417 | $this->Form->request['_Token'] = array('key' => 'testkey'); |
5418 | 5418 | $this->assertEquals(array(), $this->Form->fields); |
@@ -69,8 +69,8 @@ |
||
69 | 69 | * test method for option parsing |
70 | 70 | * |
71 | 71 | * @param $options |
72 | - * @param array $safe |
|
73 | - * @return void |
|
72 | + * @param string[] $safe |
|
73 | + * @return string |
|
74 | 74 | */ |
75 | 75 | public function testParseOptions($options, $safe = array()) { |
76 | 76 | return $this->_parseOptions($options, $safe); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @return void |
361 | 361 | */ |
362 | 362 | public function testWriteScriptsInFile() { |
363 | - $this->skipIf(!is_writable(WWW_ROOT . 'js'), 'webroot/js is not Writable, script caching test has been skipped.'); |
|
363 | + $this->skipIf( ! is_writable(WWW_ROOT.'js'), 'webroot/js is not Writable, script caching test has been skipped.'); |
|
364 | 364 | |
365 | 365 | Configure::write('Cache.disable', false); |
366 | 366 | $this->Js->request->webroot = '/'; |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | ); |
374 | 374 | $this->assertTags($result, $expected); |
375 | 375 | preg_match('/src="(.*\.js)"/', $result, $filename); |
376 | - $this->assertTrue(file_exists(WWW_ROOT . $filename[1])); |
|
377 | - $contents = file_get_contents(WWW_ROOT . $filename[1]); |
|
376 | + $this->assertTrue(file_exists(WWW_ROOT.$filename[1])); |
|
377 | + $contents = file_get_contents(WWW_ROOT.$filename[1]); |
|
378 | 378 | $this->assertRegExp('/one\s=\s1;\ntwo\s=\s2;/', $contents); |
379 | - if (file_exists(WWW_ROOT . $filename[1])) { |
|
380 | - unlink(WWW_ROOT . $filename[1]); |
|
379 | + if (file_exists(WWW_ROOT.$filename[1])) { |
|
380 | + unlink(WWW_ROOT.$filename[1]); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | Configure::write('Cache.disable', true); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $this->Js->buffer('two = 2;'); |
386 | 386 | $result = $this->Js->writeBuffer(array('onDomReady' => false, 'cache' => true)); |
387 | 387 | $this->assertRegExp('/one\s=\s1;\ntwo\s=\s2;/', $result); |
388 | - $this->assertFalse(file_exists(WWW_ROOT . $filename[1])); |
|
388 | + $this->assertFalse(file_exists(WWW_ROOT.$filename[1])); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -776,11 +776,11 @@ discard block |
||
776 | 776 | $expected = ''; |
777 | 777 | $this->assertEquals($expected, $result); |
778 | 778 | |
779 | - $result = $this->JsEngine->escape('CakePHP' . "\n" . 'Rapid Development Framework'); |
|
779 | + $result = $this->JsEngine->escape('CakePHP'."\n".'Rapid Development Framework'); |
|
780 | 780 | $expected = 'CakePHP\\nRapid Development Framework'; |
781 | 781 | $this->assertEquals($expected, $result); |
782 | 782 | |
783 | - $result = $this->JsEngine->escape('CakePHP' . "\r\n" . 'Rapid Development Framework' . "\r" . 'For PHP'); |
|
783 | + $result = $this->JsEngine->escape('CakePHP'."\r\n".'Rapid Development Framework'."\r".'For PHP'); |
|
784 | 784 | $expected = 'CakePHP\\r\\nRapid Development Framework\\rFor PHP'; |
785 | 785 | $this->assertEquals($expected, $result); |
786 | 786 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @param string $name |
65 | 65 | * @param array $params |
66 | - * @return void |
|
66 | + * @return string |
|
67 | 67 | */ |
68 | 68 | public function renderElement($name, $params = array()) { |
69 | 69 | return $name; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * getViewFileName method |
74 | 74 | * |
75 | 75 | * @param string $name |
76 | - * @return void |
|
76 | + * @return string |
|
77 | 77 | */ |
78 | 78 | public function getViewFileName($name = null) { |
79 | 79 | return $this->_getViewFileName($name); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * getLayoutFileName method |
84 | 84 | * |
85 | 85 | * @param string $name |
86 | - * @return void |
|
86 | + * @return string |
|
87 | 87 | */ |
88 | 88 | public function getLayoutFileName($name = null) { |
89 | 89 | return $this->_getLayoutFileName($name); |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | $this->PostsController->index(); |
113 | 113 | $this->ThemeView = new ThemeView($this->PostsController); |
114 | 114 | App::build(array( |
115 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), |
|
116 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
115 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS), |
|
116 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
117 | 117 | )); |
118 | 118 | App::objects('plugins', null, false); |
119 | 119 | CakePlugin::load(array('TestPlugin')); |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | $this->Controller->theme = 'TestTheme'; |
146 | 146 | |
147 | 147 | $ThemeView = new TestTheme2View($this->Controller); |
148 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Tests' . DS . 'index.ctp'; |
|
148 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Themed'.DS.'TestTheme'.DS.'Plugin'.DS.'TestPlugin'.DS.'Tests'.DS.'index.ctp'; |
|
149 | 149 | $result = $ThemeView->getViewFileName('index'); |
150 | 150 | $this->assertEquals($expected, $result); |
151 | 151 | |
152 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Layouts' . DS . 'plugin_default.ctp'; |
|
152 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Themed'.DS.'TestTheme'.DS.'Plugin'.DS.'TestPlugin'.DS.'Layouts'.DS.'plugin_default.ctp'; |
|
153 | 153 | $result = $ThemeView->getLayoutFileName('plugin_default'); |
154 | 154 | $this->assertEquals($expected, $result); |
155 | 155 | |
156 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS . 'default.ctp'; |
|
156 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Themed'.DS.'TestTheme'.DS.'Layouts'.DS.'default.ctp'; |
|
157 | 157 | $result = $ThemeView->getLayoutFileName('default'); |
158 | 158 | $this->assertEquals($expected, $result); |
159 | 159 | } |
@@ -172,25 +172,25 @@ discard block |
||
172 | 172 | |
173 | 173 | $ThemeView = new TestTheme2View($this->Controller); |
174 | 174 | $ThemeView->theme = 'TestTheme'; |
175 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp'; |
|
175 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Pages'.DS.'home.ctp'; |
|
176 | 176 | $result = $ThemeView->getViewFileName('home'); |
177 | 177 | $this->assertEquals($expected, $result); |
178 | 178 | |
179 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'index.ctp'; |
|
179 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Themed'.DS.'TestTheme'.DS.'Posts'.DS.'index.ctp'; |
|
180 | 180 | $result = $ThemeView->getViewFileName('/Posts/index'); |
181 | 181 | $this->assertEquals($expected, $result); |
182 | 182 | |
183 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS . 'default.ctp'; |
|
183 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Themed'.DS.'TestTheme'.DS.'Layouts'.DS.'default.ctp'; |
|
184 | 184 | $result = $ThemeView->getLayoutFileName(); |
185 | 185 | $this->assertEquals($expected, $result); |
186 | 186 | |
187 | 187 | $ThemeView->layoutPath = 'rss'; |
188 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Layouts' . DS . 'rss' . DS . 'default.ctp'; |
|
188 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Layouts'.DS.'rss'.DS.'default.ctp'; |
|
189 | 189 | $result = $ThemeView->getLayoutFileName(); |
190 | 190 | $this->assertEquals($expected, $result); |
191 | 191 | |
192 | - $ThemeView->layoutPath = 'Emails' . DS . 'html'; |
|
193 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Layouts' . DS . 'Emails' . DS . 'html' . DS . 'default.ctp'; |
|
192 | + $ThemeView->layoutPath = 'Emails'.DS.'html'; |
|
193 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Layouts'.DS.'Emails'.DS.'html'.DS.'default.ctp'; |
|
194 | 194 | $result = $ThemeView->getLayoutFileName(); |
195 | 195 | $this->assertEquals($expected, $result); |
196 | 196 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @param string $filePath |
46 | 46 | * @param string $params |
47 | - * @return void |
|
47 | + * @return string |
|
48 | 48 | */ |
49 | 49 | protected function _resolveTestFile($filePath, $params) { |
50 | 50 | $basePath = $this->_basePath($params) . DS . $filePath; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Generates the base path to a set of tests based on the parameters. |
57 | 57 | * |
58 | - * @param array $params |
|
58 | + * @param string $params |
|
59 | 59 | * @return string The base path. |
60 | 60 | */ |
61 | 61 | protected static function _basePath($params) { |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | * @return void |
48 | 48 | */ |
49 | 49 | protected function _resolveTestFile($filePath, $params) { |
50 | - $basePath = $this->_basePath($params) . DS . $filePath; |
|
50 | + $basePath = $this->_basePath($params).DS.$filePath; |
|
51 | 51 | $ending = 'Test.php'; |
52 | - return (strpos($basePath, $ending) === (strlen($basePath) - strlen($ending))) ? $basePath : $basePath . $ending; |
|
52 | + return (strpos($basePath, $ending) === (strlen($basePath) - strlen($ending))) ? $basePath : $basePath.$ending; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -60,19 +60,19 @@ discard block |
||
60 | 60 | */ |
61 | 61 | protected static function _basePath($params) { |
62 | 62 | $result = null; |
63 | - if (!empty($params['core'])) { |
|
63 | + if ( ! empty($params['core'])) { |
|
64 | 64 | $result = CORE_TEST_CASES; |
65 | - } elseif (!empty($params['plugin'])) { |
|
66 | - if (!CakePlugin::loaded($params['plugin'])) { |
|
65 | + } elseif ( ! empty($params['plugin'])) { |
|
66 | + if ( ! CakePlugin::loaded($params['plugin'])) { |
|
67 | 67 | try { |
68 | 68 | CakePlugin::load($params['plugin']); |
69 | - $result = CakePlugin::path($params['plugin']) . 'Test' . DS . 'Case'; |
|
69 | + $result = CakePlugin::path($params['plugin']).'Test'.DS.'Case'; |
|
70 | 70 | } catch (MissingPluginException $e) { |
71 | 71 | } |
72 | 72 | } else { |
73 | - $result = CakePlugin::path($params['plugin']) . 'Test' . DS . 'Case'; |
|
73 | + $result = CakePlugin::path($params['plugin']).'Test'.DS.'Case'; |
|
74 | 74 | } |
75 | - } elseif (!empty($params['app'])) { |
|
75 | + } elseif ( ! empty($params['app'])) { |
|
76 | 76 | $result = APP_TEST_CASES; |
77 | 77 | } |
78 | 78 | return $result; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $testCases = array(); |
92 | 92 | foreach ($fileList as $testCaseFile) { |
93 | - $case = str_replace($directory . DS, '', $testCaseFile); |
|
93 | + $case = str_replace($directory.DS, '', $testCaseFile); |
|
94 | 94 | $case = str_replace('Test.php', '', $case); |
95 | 95 | $testCases[$testCaseFile] = $case; |
96 | 96 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | protected static function _getRecursiveFileList($directory = '.') { |
109 | 109 | $fileList = array(); |
110 | - if (!is_dir($directory)) { |
|
110 | + if ( ! is_dir($directory)) { |
|
111 | 111 | return $fileList; |
112 | 112 | } |
113 | 113 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | * |
43 | 43 | * @param PHPUnit_Framework_Test $suite |
44 | 44 | * @param array $arguments |
45 | - * @return void |
|
45 | + * @return PHPUnit_Framework_TestResult |
|
46 | 46 | */ |
47 | 47 | public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array()) { |
48 | 48 | if (isset($arguments['printer'])) { |
@@ -70,7 +70,7 @@ |
||
70 | 70 | */ |
71 | 71 | protected function createTestResult() { |
72 | 72 | $result = new PHPUnit_Framework_TestResult; |
73 | - if (!empty($this->_params['codeCoverage'])) { |
|
73 | + if ( ! empty($this->_params['codeCoverage'])) { |
|
74 | 74 | if (method_exists($result, 'collectCodeCoverageInformation')) { |
75 | 75 | $result->collectCodeCoverageInformation(true); |
76 | 76 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * Construct method |
37 | 37 | * |
38 | - * @param mixed $loader |
|
38 | + * @param string $loader |
|
39 | 39 | * @param array $params list of options to be used for this run |
40 | 40 | * @throws MissingTestLoaderException When a loader class could not be found. |
41 | 41 | */ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @throws MissingTestLoaderException When a loader class could not be found. |
41 | 41 | */ |
42 | 42 | public function __construct($loader, $params = array()) { |
43 | - if ($loader && !class_exists($loader)) { |
|
43 | + if ($loader && ! class_exists($loader)) { |
|
44 | 44 | throw new MissingTestLoaderException(array('class' => $loader)); |
45 | 45 | } |
46 | 46 | $this->arguments['loader'] = $loader; |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | try { |
96 | 96 | $result = $runner->doRun($suite, $this->arguments); |
97 | 97 | } catch (PHPUnit_Framework_Exception $e) { |
98 | - print $e->getMessage() . "\n"; |
|
98 | + print $e->getMessage()."\n"; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | if ($exit) { |
102 | 102 | if (isset($result) && $result->wasSuccessful()) { |
103 | 103 | exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT); |
104 | - } elseif (!isset($result) || $result->errorCount() > 0) { |
|
104 | + } elseif ( ! isset($result) || $result->errorCount() > 0) { |
|
105 | 105 | exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT); |
106 | 106 | } |
107 | 107 | exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT); |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | $object = null; |
139 | 139 | |
140 | 140 | $reporter = ucwords($reporter); |
141 | - $coreClass = 'Cake' . $reporter . 'Reporter'; |
|
141 | + $coreClass = 'Cake'.$reporter.'Reporter'; |
|
142 | 142 | App::uses($coreClass, 'TestSuite/Reporter'); |
143 | 143 | |
144 | - $appClass = $reporter . 'Reporter'; |
|
144 | + $appClass = $reporter.'Reporter'; |
|
145 | 145 | App::uses($appClass, 'TestSuite/Reporter'); |
146 | 146 | |
147 | - if (!class_exists($appClass)) { |
|
147 | + if ( ! class_exists($appClass)) { |
|
148 | 148 | $object = new $coreClass(null, $this->_params); |
149 | 149 | } else { |
150 | 150 | $object = new $appClass(null, $this->_params); |