@@ -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'); |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * FormHelperTest file |
|
4 | - * |
|
5 | - * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> |
|
6 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
7 | - * |
|
8 | - * Licensed under The MIT License |
|
9 | - * For full copyright and license information, please see the LICENSE.txt |
|
10 | - * Redistributions of files must retain the above copyright notice |
|
11 | - * |
|
12 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
13 | - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests |
|
14 | - * @package Cake.Test.Case.View.Helper |
|
15 | - * @since CakePHP(tm) v 1.2.0.4206 |
|
16 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
17 | - */ |
|
3 | + * FormHelperTest file |
|
4 | + * |
|
5 | + * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> |
|
6 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
7 | + * |
|
8 | + * Licensed under The MIT License |
|
9 | + * For full copyright and license information, please see the LICENSE.txt |
|
10 | + * Redistributions of files must retain the above copyright notice |
|
11 | + * |
|
12 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
13 | + * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests |
|
14 | + * @package Cake.Test.Case.View.Helper |
|
15 | + * @since CakePHP(tm) v 1.2.0.4206 |
|
16 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
17 | + */ |
|
18 | 18 | |
19 | 19 | App::uses('ClassRegistry', 'Utility'); |
20 | 20 | App::uses('Controller', 'Controller'); |
@@ -5408,11 +5408,11 @@ discard block |
||
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); |
@@ -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')); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * @param string $exclude |
60 | 60 | * @param string $insertBefore |
61 | 61 | * @param string $insertAfter |
62 | - * @return void |
|
62 | + * @return string |
|
63 | 63 | */ |
64 | 64 | public function parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) { |
65 | 65 | return $this->_parseAttributes($options, $exclude, $insertBefore, $insertAfter); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | App::uses('ClassRegistry', 'Utility'); |
25 | 25 | App::uses('Folder', 'Utility'); |
26 | 26 | |
27 | -if (!defined('FULL_BASE_URL')) { |
|
27 | +if ( ! defined('FULL_BASE_URL')) { |
|
28 | 28 | define('FULL_BASE_URL', 'http://cakephp.org'); |
29 | 29 | } |
30 | 30 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return mixed |
73 | 73 | */ |
74 | 74 | public function getAttribute($attribute) { |
75 | - if (!isset($this->{$attribute})) { |
|
75 | + if ( ! isset($this->{$attribute})) { |
|
76 | 76 | return null; |
77 | 77 | } |
78 | 78 | return $this->{$attribute}; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $this->Html->request->webroot = ''; |
151 | 151 | |
152 | 152 | App::build(array( |
153 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
153 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
154 | 154 | )); |
155 | 155 | |
156 | 156 | Configure::write('Asset.timestamp', false); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | Router::reload(); |
209 | 209 | |
210 | 210 | $result = $this->Html->link('Posts', array('controller' => 'posts', 'action' => 'index', 'full_base' => true)); |
211 | - $expected = array('a' => array('href' => Router::fullBaseUrl() . '/posts'), 'Posts', '/a'); |
|
211 | + $expected = array('a' => array('href' => Router::fullBaseUrl().'/posts'), 'Posts', '/a'); |
|
212 | 212 | $this->assertTags($result, $expected); |
213 | 213 | |
214 | 214 | $result = $this->Html->link('Home', '/home', array('confirm' => 'Are you sure you want to do this?')); |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | public function testImageWithFullBase() { |
465 | 465 | $result = $this->Html->image('test.gif', array('fullBase' => true)); |
466 | 466 | $here = $this->Html->url('/', true); |
467 | - $this->assertTags($result, array('img' => array('src' => $here . 'img/test.gif', 'alt' => ''))); |
|
467 | + $this->assertTags($result, array('img' => array('src' => $here.'img/test.gif', 'alt' => ''))); |
|
468 | 468 | |
469 | 469 | $result = $this->Html->image('sub/test.gif', array('fullBase' => true)); |
470 | 470 | $here = $this->Html->url('/', true); |
471 | - $this->assertTags($result, array('img' => array('src' => $here . 'img/sub/test.gif', 'alt' => ''))); |
|
471 | + $this->assertTags($result, array('img' => array('src' => $here.'img/sub/test.gif', 'alt' => ''))); |
|
472 | 472 | |
473 | 473 | $request = $this->Html->request; |
474 | 474 | $request->webroot = '/myproject/'; |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | |
478 | 478 | $result = $this->Html->image('sub/test.gif', array('fullBase' => true)); |
479 | 479 | $here = $this->Html->url('/', true); |
480 | - $this->assertTags($result, array('img' => array('src' => $here . 'img/sub/test.gif', 'alt' => ''))); |
|
480 | + $this->assertTags($result, array('img' => array('src' => $here.'img/sub/test.gif', 'alt' => ''))); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -512,16 +512,16 @@ discard block |
||
512 | 512 | * @return void |
513 | 513 | */ |
514 | 514 | public function testImageTagWithTheme() { |
515 | - $this->skipIf(!is_writable(WWW_ROOT), 'Cannot write to webroot.'); |
|
516 | - $themeExists = is_dir(WWW_ROOT . 'theme'); |
|
515 | + $this->skipIf( ! is_writable(WWW_ROOT), 'Cannot write to webroot.'); |
|
516 | + $themeExists = is_dir(WWW_ROOT.'theme'); |
|
517 | 517 | |
518 | 518 | App::uses('File', 'Utility'); |
519 | 519 | |
520 | - $testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'img' . DS . '__cake_test_image.gif'; |
|
520 | + $testfile = WWW_ROOT.'theme'.DS.'test_theme'.DS.'img'.DS.'__cake_test_image.gif'; |
|
521 | 521 | new File($testfile, true); |
522 | 522 | |
523 | 523 | App::build(array( |
524 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
524 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
525 | 525 | )); |
526 | 526 | Configure::write('Asset.timestamp', true); |
527 | 527 | Configure::write('debug', 1); |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | 'alt' => '' |
545 | 545 | ))); |
546 | 546 | |
547 | - $dir = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme'); |
|
547 | + $dir = new Folder(WWW_ROOT.'theme'.DS.'test_theme'); |
|
548 | 548 | $dir->delete(); |
549 | - if (!$themeExists) { |
|
550 | - $dir = new Folder(WWW_ROOT . 'theme'); |
|
549 | + if ( ! $themeExists) { |
|
550 | + $dir = new Folder(WWW_ROOT.'theme'); |
|
551 | 551 | $dir->delete(); |
552 | 552 | } |
553 | 553 | } |
@@ -559,10 +559,10 @@ discard block |
||
559 | 559 | */ |
560 | 560 | public function testThemeAssetsInMainWebrootPath() { |
561 | 561 | App::build(array( |
562 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
562 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
563 | 563 | )); |
564 | 564 | $webRoot = Configure::read('App.www_root'); |
565 | - Configure::write('App.www_root', CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS); |
|
565 | + Configure::write('App.www_root', CAKE.'Test'.DS.'test_app'.DS.'webroot'.DS); |
|
566 | 566 | |
567 | 567 | $this->Html->theme = 'test_theme'; |
568 | 568 | $result = $this->Html->css('webroot_test'); |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | |
742 | 742 | $result = $this->Html->css('screen', null, array('fullBase' => true)); |
743 | 743 | $expected = array( |
744 | - 'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $here . 'css/screen.css') |
|
744 | + 'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $here.'css/screen.css') |
|
745 | 745 | ); |
746 | 746 | $this->assertTags($result, $expected); |
747 | 747 | } |
@@ -879,22 +879,22 @@ discard block |
||
879 | 879 | * @return void |
880 | 880 | */ |
881 | 881 | public function testScriptTimestamping() { |
882 | - $this->skipIf(!is_writable(WWW_ROOT . 'js'), 'webroot/js is not Writable, timestamp testing has been skipped.'); |
|
882 | + $this->skipIf( ! is_writable(WWW_ROOT.'js'), 'webroot/js is not Writable, timestamp testing has been skipped.'); |
|
883 | 883 | |
884 | 884 | Configure::write('debug', 2); |
885 | 885 | Configure::write('Asset.timestamp', true); |
886 | 886 | |
887 | - touch(WWW_ROOT . 'js' . DS . '__cake_js_test.js'); |
|
887 | + touch(WWW_ROOT.'js'.DS.'__cake_js_test.js'); |
|
888 | 888 | $timestamp = substr(strtotime('now'), 0, 8); |
889 | 889 | |
890 | 890 | $result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false)); |
891 | - $this->assertRegExp('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s'); |
|
891 | + $this->assertRegExp('/__cake_js_test.js\?'.$timestamp.'[0-9]{2}"/', $result, 'Timestamp value not found %s'); |
|
892 | 892 | |
893 | 893 | Configure::write('debug', 0); |
894 | 894 | Configure::write('Asset.timestamp', 'force'); |
895 | 895 | $result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false)); |
896 | - $this->assertRegExp('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s'); |
|
897 | - unlink(WWW_ROOT . 'js' . DS . '__cake_js_test.js'); |
|
896 | + $this->assertRegExp('/__cake_js_test.js\?'.$timestamp.'[0-9]{2}"/', $result, 'Timestamp value not found %s'); |
|
897 | + unlink(WWW_ROOT.'js'.DS.'__cake_js_test.js'); |
|
898 | 898 | Configure::write('Asset.timestamp', false); |
899 | 899 | } |
900 | 900 | |
@@ -907,23 +907,23 @@ discard block |
||
907 | 907 | CakePlugin::load('TestPlugin'); |
908 | 908 | |
909 | 909 | $pluginPath = App::pluginPath('TestPlugin'); |
910 | - $pluginJsPath = $pluginPath . 'webroot/js'; |
|
911 | - $this->skipIf(!is_writable($pluginJsPath), $pluginJsPath . ' is not Writable, timestamp testing has been skipped.'); |
|
910 | + $pluginJsPath = $pluginPath.'webroot/js'; |
|
911 | + $this->skipIf( ! is_writable($pluginJsPath), $pluginJsPath.' is not Writable, timestamp testing has been skipped.'); |
|
912 | 912 | |
913 | 913 | Configure::write('debug', 2); |
914 | 914 | Configure::write('Asset.timestamp', true); |
915 | 915 | |
916 | - touch($pluginJsPath . DS . '__cake_js_test.js'); |
|
916 | + touch($pluginJsPath.DS.'__cake_js_test.js'); |
|
917 | 917 | $timestamp = substr(strtotime('now'), 0, 8); |
918 | 918 | |
919 | 919 | $result = $this->Html->script('TestPlugin.__cake_js_test', array('inline' => true, 'once' => false)); |
920 | - $this->assertRegExp('/test_plugin\/js\/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s'); |
|
920 | + $this->assertRegExp('/test_plugin\/js\/__cake_js_test.js\?'.$timestamp.'[0-9]{2}"/', $result, 'Timestamp value not found %s'); |
|
921 | 921 | |
922 | 922 | Configure::write('debug', 0); |
923 | 923 | Configure::write('Asset.timestamp', 'force'); |
924 | 924 | $result = $this->Html->script('TestPlugin.__cake_js_test', array('inline' => true, 'once' => false)); |
925 | - $this->assertRegExp('/test_plugin\/js\/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s'); |
|
926 | - unlink($pluginJsPath . DS . '__cake_js_test.js'); |
|
925 | + $this->assertRegExp('/test_plugin\/js\/__cake_js_test.js\?'.$timestamp.'[0-9]{2}"/', $result, 'Timestamp value not found %s'); |
|
926 | + unlink($pluginJsPath.DS.'__cake_js_test.js'); |
|
927 | 927 | Configure::write('Asset.timestamp', false); |
928 | 928 | |
929 | 929 | CakePlugin::unload('TestPlugin'); |
@@ -1149,15 +1149,15 @@ discard block |
||
1149 | 1149 | |
1150 | 1150 | $result = $this->Html->script('foo', array('fullBase' => true)); |
1151 | 1151 | $expected = array( |
1152 | - 'script' => array('type' => 'text/javascript', 'src' => $here . 'js/foo.js') |
|
1152 | + 'script' => array('type' => 'text/javascript', 'src' => $here.'js/foo.js') |
|
1153 | 1153 | ); |
1154 | 1154 | $this->assertTags($result, $expected); |
1155 | 1155 | |
1156 | 1156 | $result = $this->Html->script(array('foobar', 'bar'), array('fullBase' => true)); |
1157 | 1157 | $expected = array( |
1158 | - array('script' => array('type' => 'text/javascript', 'src' => $here . 'js/foobar.js')), |
|
1158 | + array('script' => array('type' => 'text/javascript', 'src' => $here.'js/foobar.js')), |
|
1159 | 1159 | '/script', |
1160 | - array('script' => array('type' => 'text/javascript', 'src' => $here . 'js/bar.js')), |
|
1160 | + array('script' => array('type' => 'text/javascript', 'src' => $here.'js/bar.js')), |
|
1161 | 1161 | '/script', |
1162 | 1162 | ); |
1163 | 1163 | $this->assertTags($result, $expected); |
@@ -1169,16 +1169,16 @@ discard block |
||
1169 | 1169 | * @return void |
1170 | 1170 | */ |
1171 | 1171 | public function testScriptInTheme() { |
1172 | - $this->skipIf(!is_writable(WWW_ROOT), 'Cannot write to webroot.'); |
|
1173 | - $themeExists = is_dir(WWW_ROOT . 'theme'); |
|
1172 | + $this->skipIf( ! is_writable(WWW_ROOT), 'Cannot write to webroot.'); |
|
1173 | + $themeExists = is_dir(WWW_ROOT.'theme'); |
|
1174 | 1174 | |
1175 | 1175 | App::uses('File', 'Utility'); |
1176 | 1176 | |
1177 | - $testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'js' . DS . '__test_js.js'; |
|
1177 | + $testfile = WWW_ROOT.'theme'.DS.'test_theme'.DS.'js'.DS.'__test_js.js'; |
|
1178 | 1178 | new File($testfile, true); |
1179 | 1179 | |
1180 | 1180 | App::build(array( |
1181 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
1181 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
1182 | 1182 | )); |
1183 | 1183 | |
1184 | 1184 | $this->Html->webroot = '/'; |
@@ -1189,11 +1189,11 @@ discard block |
||
1189 | 1189 | ); |
1190 | 1190 | $this->assertTags($result, $expected); |
1191 | 1191 | |
1192 | - $Folder = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme'); |
|
1192 | + $Folder = new Folder(WWW_ROOT.'theme'.DS.'test_theme'); |
|
1193 | 1193 | $Folder->delete(); |
1194 | 1194 | |
1195 | - if (!$themeExists) { |
|
1196 | - $dir = new Folder(WWW_ROOT . 'theme'); |
|
1195 | + if ( ! $themeExists) { |
|
1196 | + $dir = new Folder(WWW_ROOT.'theme'); |
|
1197 | 1197 | $dir->delete(); |
1198 | 1198 | } |
1199 | 1199 | } |
@@ -1994,7 +1994,7 @@ discard block |
||
1994 | 1994 | array('pathPrefix' => 'videos/', 'poster' => 'poster.jpg', 'text' => 'Your browser does not support the HTML5 Video element.') |
1995 | 1995 | ); |
1996 | 1996 | $expected = array( |
1997 | - 'video' => array('poster' => Configure::read('App.imageBaseUrl') . 'poster.jpg'), |
|
1997 | + 'video' => array('poster' => Configure::read('App.imageBaseUrl').'poster.jpg'), |
|
1998 | 1998 | array('source' => array('src' => 'videos/video.webm', 'type' => 'video/webm')), |
1999 | 1999 | array('source' => array('src' => 'videos/video.ogv', 'type' => 'video/ogg; codecs='theora, vorbis'')), |
2000 | 2000 | 'Your browser does not support the HTML5 Video element.', |
@@ -2181,7 +2181,7 @@ discard block |
||
2181 | 2181 | */ |
2182 | 2182 | |
2183 | 2183 | public function testLoadConfig() { |
2184 | - $path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS; |
|
2184 | + $path = CAKE.'Test'.DS.'test_app'.DS.'Config'.DS; |
|
2185 | 2185 | |
2186 | 2186 | $result = $this->Html->loadConfig('htmlhelper_tags', $path); |
2187 | 2187 | $expected = array( |
@@ -2222,7 +2222,7 @@ discard block |
||
2222 | 2222 | * @expectedException ConfigureException |
2223 | 2223 | */ |
2224 | 2224 | public function testLoadConfigWrongReader() { |
2225 | - $path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS; |
|
2225 | + $path = CAKE.'Test'.DS.'test_app'.DS.'Config'.DS; |
|
2226 | 2226 | $this->Html->loadConfig(array('htmlhelper_tags', 'wrong_reader'), $path); |
2227 | 2227 | } |
2228 | 2228 | |
@@ -2239,8 +2239,8 @@ discard block |
||
2239 | 2239 | foreach ($compact as $attribute) { |
2240 | 2240 | foreach (array('true', true, 1, '1', $attribute) as $value) { |
2241 | 2241 | $attrs = array($attribute => $value); |
2242 | - $expected = ' ' . $attribute . '="' . $attribute . '"'; |
|
2243 | - $this->assertEquals($expected, $helper->parseAttributes($attrs), '%s Failed on ' . $value); |
|
2242 | + $expected = ' '.$attribute.'="'.$attribute.'"'; |
|
2243 | + $this->assertEquals($expected, $helper->parseAttributes($attrs), '%s Failed on '.$value); |
|
2244 | 2244 | } |
2245 | 2245 | } |
2246 | 2246 | $this->assertEquals(' compact="compact"', $helper->parseAttributes(array('compact'))); |
@@ -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); |
@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * JsHelper Test Case |
|
4 | - * |
|
5 | - * TestCase for the JsHelper |
|
6 | - * |
|
7 | - * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> |
|
8 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
9 | - * |
|
10 | - * Licensed under The MIT License |
|
11 | - * For full copyright and license information, please see the LICENSE.txt |
|
12 | - * Redistributions of files must retain the above copyright notice |
|
13 | - * |
|
14 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
15 | - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests |
|
16 | - * @package Cake.Test.Case.View.Helper |
|
17 | - * @since CakePHP(tm) v 1.3 |
|
18 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
19 | - */ |
|
3 | + * JsHelper Test Case |
|
4 | + * |
|
5 | + * TestCase for the JsHelper |
|
6 | + * |
|
7 | + * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> |
|
8 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
9 | + * |
|
10 | + * Licensed under The MIT License |
|
11 | + * For full copyright and license information, please see the LICENSE.txt |
|
12 | + * Redistributions of files must retain the above copyright notice |
|
13 | + * |
|
14 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
15 | + * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests |
|
16 | + * @package Cake.Test.Case.View.Helper |
|
17 | + * @since CakePHP(tm) v 1.3 |
|
18 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
19 | + */ |
|
20 | 20 | |
21 | 21 | App::uses('HtmlHelper', 'View/Helper'); |
22 | 22 | App::uses('JsHelper', 'View/Helper'); |
@@ -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 |
@@ -181,7 +181,7 @@ |
||
181 | 181 | * @param string $exclude |
182 | 182 | * @param string $insertBefore |
183 | 183 | * @param string $insertAfter |
184 | - * @return void |
|
184 | + * @return string |
|
185 | 185 | */ |
186 | 186 | public function parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) { |
187 | 187 | return $this->_parseAttributes($options, $exclude, $insertBefore, $insertAfter); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | ClassRegistry::addObject('HelperTestTag', new HelperTestTag()); |
217 | 217 | |
218 | 218 | App::build(array( |
219 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), |
|
219 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS), |
|
220 | 220 | )); |
221 | 221 | } |
222 | 222 | |
@@ -598,8 +598,8 @@ discard block |
||
598 | 598 | public function testAssetTimestamp() { |
599 | 599 | Configure::write('Foo.bar', 'test'); |
600 | 600 | Configure::write('Asset.timestamp', false); |
601 | - $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css'); |
|
602 | - $this->assertEquals(Configure::read('App.cssBaseUrl') . 'cake.generic.css', $result); |
|
601 | + $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl').'cake.generic.css'); |
|
602 | + $this->assertEquals(Configure::read('App.cssBaseUrl').'cake.generic.css', $result); |
|
603 | 603 | |
604 | 604 | Configure::write('Asset.timestamp', true); |
605 | 605 | Configure::write('debug', 0); |
@@ -607,25 +607,25 @@ discard block |
||
607 | 607 | $result = $this->Helper->assetTimestamp('/%3Cb%3E/cake.generic.css'); |
608 | 608 | $this->assertEquals('/%3Cb%3E/cake.generic.css', $result); |
609 | 609 | |
610 | - $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css'); |
|
611 | - $this->assertEquals(Configure::read('App.cssBaseUrl') . 'cake.generic.css', $result); |
|
610 | + $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl').'cake.generic.css'); |
|
611 | + $this->assertEquals(Configure::read('App.cssBaseUrl').'cake.generic.css', $result); |
|
612 | 612 | |
613 | 613 | Configure::write('Asset.timestamp', true); |
614 | 614 | Configure::write('debug', 2); |
615 | - $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css'); |
|
616 | - $this->assertRegExp('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result); |
|
615 | + $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl').'cake.generic.css'); |
|
616 | + $this->assertRegExp('/'.preg_quote(Configure::read('App.cssBaseUrl').'cake.generic.css?', '/').'[0-9]+/', $result); |
|
617 | 617 | |
618 | 618 | Configure::write('Asset.timestamp', 'force'); |
619 | 619 | Configure::write('debug', 0); |
620 | - $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css'); |
|
621 | - $this->assertRegExp('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result); |
|
620 | + $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl').'cake.generic.css'); |
|
621 | + $this->assertRegExp('/'.preg_quote(Configure::read('App.cssBaseUrl').'cake.generic.css?', '/').'[0-9]+/', $result); |
|
622 | 622 | |
623 | - $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl') . 'cake.generic.css?someparam'); |
|
624 | - $this->assertEquals(Configure::read('App.cssBaseUrl') . 'cake.generic.css?someparam', $result); |
|
623 | + $result = $this->Helper->assetTimestamp(Configure::read('App.cssBaseUrl').'cake.generic.css?someparam'); |
|
624 | + $this->assertEquals(Configure::read('App.cssBaseUrl').'cake.generic.css?someparam', $result); |
|
625 | 625 | |
626 | 626 | $this->Helper->request->webroot = '/some/dir/'; |
627 | - $result = $this->Helper->assetTimestamp('/some/dir/' . Configure::read('App.cssBaseUrl') . 'cake.generic.css'); |
|
628 | - $this->assertRegExp('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result); |
|
627 | + $result = $this->Helper->assetTimestamp('/some/dir/'.Configure::read('App.cssBaseUrl').'cake.generic.css'); |
|
628 | + $this->assertRegExp('/'.preg_quote(Configure::read('App.cssBaseUrl').'cake.generic.css?', '/').'[0-9]+/', $result); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | /** |
@@ -642,13 +642,13 @@ discard block |
||
642 | 642 | ), |
643 | 643 | array('fullBase' => true) |
644 | 644 | ); |
645 | - $this->assertEquals(Router::fullBaseUrl() . '/js/post.js', $result); |
|
645 | + $this->assertEquals(Router::fullBaseUrl().'/js/post.js', $result); |
|
646 | 646 | |
647 | 647 | $result = $this->Helper->assetUrl('foo.jpg', array('pathPrefix' => 'img/')); |
648 | 648 | $this->assertEquals('img/foo.jpg', $result); |
649 | 649 | |
650 | 650 | $result = $this->Helper->assetUrl('foo.jpg', array('fullBase' => true)); |
651 | - $this->assertEquals(Router::fullBaseUrl() . '/foo.jpg', $result); |
|
651 | + $this->assertEquals(Router::fullBaseUrl().'/foo.jpg', $result); |
|
652 | 652 | |
653 | 653 | $result = $this->Helper->assetUrl('style', array('ext' => '.css')); |
654 | 654 | $this->assertEquals('style.css', $result); |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | 'here' => '/cake_dev/index.php/tasks', |
676 | 676 | )); |
677 | 677 | $result = $this->Helper->assetUrl('img/cake.icon.png', array('fullBase' => true)); |
678 | - $expected = FULL_BASE_URL . '/cake_dev/app/webroot/img/cake.icon.png'; |
|
678 | + $expected = FULL_BASE_URL.'/cake_dev/app/webroot/img/cake.icon.png'; |
|
679 | 679 | $this->assertEquals($expected, $result); |
680 | 680 | } |
681 | 681 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | Configure::write('Asset.timestamp', 'force'); |
708 | 708 | |
709 | 709 | $result = $this->Helper->assetUrl('cake.generic.css', array('pathPrefix' => Configure::read('App.cssBaseUrl'))); |
710 | - $this->assertRegExp('/' . preg_quote(Configure::read('App.cssBaseUrl') . 'cake.generic.css?', '/') . '[0-9]+/', $result); |
|
710 | + $this->assertRegExp('/'.preg_quote(Configure::read('App.cssBaseUrl').'cake.generic.css?', '/').'[0-9]+/', $result); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | /** |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | public function testAssetTimestampPluginsAndThemes() { |
719 | 719 | Configure::write('Asset.timestamp', 'force'); |
720 | 720 | App::build(array( |
721 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS), |
|
721 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS), |
|
722 | 722 | )); |
723 | 723 | CakePlugin::load(array('TestPlugin')); |
724 | 724 | |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | $this->assertEquals($expected, $this->Helper->entity()); |
785 | 785 | |
786 | 786 | foreach (array('year', 'month', 'day', 'hour', 'min', 'meridian') as $d) { |
787 | - $this->Helper->setEntity('date.' . $d); |
|
787 | + $this->Helper->setEntity('date.'.$d); |
|
788 | 788 | $expected = array('HelperTestPost', 'date', $d); |
789 | 789 | $this->assertEquals($expected, $this->Helper->entity()); |
790 | 790 | } |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | $this->Helper->theme = 'test_theme'; |
925 | 925 | |
926 | 926 | App::build(array( |
927 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
927 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
928 | 928 | )); |
929 | 929 | |
930 | 930 | $result = $this->Helper->webroot('/img/cake.power.gif'); |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $this->assertEquals($expected, $result); |
937 | 937 | |
938 | 938 | $webRoot = Configure::read('App.www_root'); |
939 | - Configure::write('App.www_root', CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS); |
|
939 | + Configure::write('App.www_root', CAKE.'Test'.DS.'test_app'.DS.'webroot'.DS); |
|
940 | 940 | |
941 | 941 | $result = $this->Helper->webroot('/img/cake.power.gif'); |
942 | 942 | $expected = '/theme/test_theme/img/cake.power.gif'; |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | */ |
965 | 965 | public function testLazyLoadingHelpers() { |
966 | 966 | App::build(array( |
967 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), |
|
967 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS), |
|
968 | 968 | )); |
969 | 969 | CakePlugin::load(array('TestPlugin')); |
970 | 970 | $Helper = new TestHelper($this->View); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * testGetFilename method |
35 | 35 | * |
36 | 36 | * @param string $action |
37 | - * @return void |
|
37 | + * @return string |
|
38 | 38 | */ |
39 | 39 | public function testGetFilename($action) { |
40 | 40 | return $this->_getViewFileName($action); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | App::uses('ScaffoldView', 'View'); |
22 | 22 | App::uses('AppModel', 'Model'); |
23 | 23 | |
24 | -require_once dirname(dirname(__FILE__)) . DS . 'Model' . DS . 'models.php'; |
|
24 | +require_once dirname(dirname(__FILE__)).DS.'Model'.DS.'models.php'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * TestScaffoldView class |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $this->Controller->response = $this->getMock('CakeResponse', array('_sendHeader')); |
91 | 91 | |
92 | 92 | App::build(array( |
93 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS), |
|
94 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
93 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS), |
|
94 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
95 | 95 | )); |
96 | 96 | CakePlugin::load('TestPlugin'); |
97 | 97 | } |
@@ -118,39 +118,39 @@ discard block |
||
118 | 118 | $this->Controller->request->params['action'] = 'index'; |
119 | 119 | $ScaffoldView = new TestScaffoldView($this->Controller); |
120 | 120 | $result = $ScaffoldView->testGetFilename('index'); |
121 | - $expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'index.ctp'; |
|
121 | + $expected = CAKE.'View'.DS.'Scaffolds'.DS.'index.ctp'; |
|
122 | 122 | $this->assertEquals($expected, $result); |
123 | 123 | |
124 | 124 | $result = $ScaffoldView->testGetFilename('edit'); |
125 | - $expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'form.ctp'; |
|
125 | + $expected = CAKE.'View'.DS.'Scaffolds'.DS.'form.ctp'; |
|
126 | 126 | $this->assertEquals($expected, $result); |
127 | 127 | |
128 | 128 | $result = $ScaffoldView->testGetFilename('add'); |
129 | - $expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'form.ctp'; |
|
129 | + $expected = CAKE.'View'.DS.'Scaffolds'.DS.'form.ctp'; |
|
130 | 130 | $this->assertEquals($expected, $result); |
131 | 131 | |
132 | 132 | $result = $ScaffoldView->testGetFilename('view'); |
133 | - $expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'view.ctp'; |
|
133 | + $expected = CAKE.'View'.DS.'Scaffolds'.DS.'view.ctp'; |
|
134 | 134 | $this->assertEquals($expected, $result); |
135 | 135 | |
136 | 136 | $result = $ScaffoldView->testGetFilename('admin_index'); |
137 | - $expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'index.ctp'; |
|
137 | + $expected = CAKE.'View'.DS.'Scaffolds'.DS.'index.ctp'; |
|
138 | 138 | $this->assertEquals($expected, $result); |
139 | 139 | |
140 | 140 | $result = $ScaffoldView->testGetFilename('admin_view'); |
141 | - $expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'view.ctp'; |
|
141 | + $expected = CAKE.'View'.DS.'Scaffolds'.DS.'view.ctp'; |
|
142 | 142 | $this->assertEquals($expected, $result); |
143 | 143 | |
144 | 144 | $result = $ScaffoldView->testGetFilename('admin_edit'); |
145 | - $expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'form.ctp'; |
|
145 | + $expected = CAKE.'View'.DS.'Scaffolds'.DS.'form.ctp'; |
|
146 | 146 | $this->assertEquals($expected, $result); |
147 | 147 | |
148 | 148 | $result = $ScaffoldView->testGetFilename('admin_add'); |
149 | - $expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'form.ctp'; |
|
149 | + $expected = CAKE.'View'.DS.'Scaffolds'.DS.'form.ctp'; |
|
150 | 150 | $this->assertEquals($expected, $result); |
151 | 151 | |
152 | 152 | $result = $ScaffoldView->testGetFilename('error'); |
153 | - $expected = CAKE . 'View' . DS . 'Errors' . DS . 'scaffold_error.ctp'; |
|
153 | + $expected = CAKE.'View'.DS.'Errors'.DS.'scaffold_error.ctp'; |
|
154 | 154 | $this->assertEquals($expected, $result); |
155 | 155 | |
156 | 156 | $Controller = new ScaffoldViewMockController($this->request); |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | |
161 | 161 | $ScaffoldView = new TestScaffoldView($Controller); |
162 | 162 | $result = $ScaffoldView->testGetFilename('admin_edit'); |
163 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'scaffold.form.ctp'; |
|
163 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Posts'.DS.'scaffold.form.ctp'; |
|
164 | 164 | $this->assertEquals($expected, $result); |
165 | 165 | |
166 | 166 | $result = $ScaffoldView->testGetFilename('edit'); |
167 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'scaffold.form.ctp'; |
|
167 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS.'Posts'.DS.'scaffold.form.ctp'; |
|
168 | 168 | $this->assertEquals($expected, $result); |
169 | 169 | |
170 | 170 | $Controller = new ScaffoldViewMockController($this->request); |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | |
180 | 180 | $ScaffoldView = new TestScaffoldView($Controller); |
181 | 181 | $result = $ScaffoldView->testGetFilename('admin_add'); |
182 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . |
|
183 | - DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp'; |
|
182 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'Plugin'. |
|
183 | + DS.'TestPlugin'.DS.'View'.DS.'Tests'.DS.'scaffold.form.ctp'; |
|
184 | 184 | $this->assertEquals($expected, $result); |
185 | 185 | |
186 | 186 | $result = $ScaffoldView->testGetFilename('add'); |
187 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . |
|
188 | - DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp'; |
|
187 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'Plugin'. |
|
188 | + DS.'TestPlugin'.DS.'View'.DS.'Tests'.DS.'scaffold.form.ctp'; |
|
189 | 189 | $this->assertEquals($expected, $result); |
190 | 190 | |
191 | 191 | Configure::write('Routing.prefixes', $_admin); |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $ScaffoldView = new TestScaffoldView($this->Controller); |
204 | 204 | |
205 | 205 | $result = $ScaffoldView->testGetFilename('index'); |
206 | - $expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . |
|
207 | - 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'scaffold.index.ctp'; |
|
206 | + $expected = CAKE.'Test'.DS.'test_app'.DS.'View'.DS. |
|
207 | + 'Themed'.DS.'TestTheme'.DS.'Posts'.DS.'scaffold.index.ctp'; |
|
208 | 208 | $this->assertEquals($expected, $result); |
209 | 209 | } |
210 | 210 |
@@ -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 | } |
@@ -196,8 +196,6 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * Chooses which fixtures to load for a given test |
198 | 198 | * |
199 | - * @param string $fixture Each parameter is a model name that corresponds to a |
|
200 | - * fixture, i.e. 'Post', 'Author', etc. |
|
201 | 199 | * @return void |
202 | 200 | * @see CakeTestCase::$autoFixtures |
203 | 201 | * @throws Exception when no fixture manager is available. |
@@ -219,7 +217,7 @@ discard block |
||
219 | 217 | * @param string $expected The expected value. |
220 | 218 | * @param string $result The actual value. |
221 | 219 | * @param message The message to use for failure. |
222 | - * @return boolean |
|
220 | + * @return boolean|null |
|
223 | 221 | */ |
224 | 222 | public function assertTextNotEquals($expected, $result, $message = '') { |
225 | 223 | $expected = str_replace(array("\r\n", "\r"), "\n", $expected); |
@@ -234,7 +232,7 @@ discard block |
||
234 | 232 | * @param string $expected The expected value. |
235 | 233 | * @param string $result The actual value. |
236 | 234 | * @param message The message to use for failure. |
237 | - * @return boolean |
|
235 | + * @return boolean|null |
|
238 | 236 | */ |
239 | 237 | public function assertTextEquals($expected, $result, $message = '') { |
240 | 238 | $expected = str_replace(array("\r\n", "\r"), "\n", $expected); |
@@ -246,10 +244,10 @@ discard block |
||
246 | 244 | * Asserts that a string starts with a given prefix, ignoring differences in newlines. |
247 | 245 | * Helpful for doing cross platform tests of blocks of text. |
248 | 246 | * |
249 | - * @param string $prefix |
|
247 | + * @param string string |
|
250 | 248 | * @param string $string |
251 | - * @param string $message |
|
252 | - * @return boolean |
|
249 | + * @param string string |
|
250 | + * @return boolean|null |
|
253 | 251 | */ |
254 | 252 | public function assertTextStartsWith($prefix, $string, $message = '') { |
255 | 253 | $prefix = str_replace(array("\r\n", "\r"), "\n", $prefix); |
@@ -261,10 +259,10 @@ discard block |
||
261 | 259 | * Asserts that a string starts not with a given prefix, ignoring differences in newlines. |
262 | 260 | * Helpful for doing cross platform tests of blocks of text. |
263 | 261 | * |
264 | - * @param string $prefix |
|
262 | + * @param string string |
|
265 | 263 | * @param string $string |
266 | - * @param string $message |
|
267 | - * @return boolean |
|
264 | + * @param string string |
|
265 | + * @return boolean|null |
|
268 | 266 | */ |
269 | 267 | public function assertTextStartsNotWith($prefix, $string, $message = '') { |
270 | 268 | $prefix = str_replace(array("\r\n", "\r"), "\n", $prefix); |
@@ -276,10 +274,10 @@ discard block |
||
276 | 274 | * Asserts that a string ends with a given prefix, ignoring differences in newlines. |
277 | 275 | * Helpful for doing cross platform tests of blocks of text. |
278 | 276 | * |
279 | - * @param string $suffix |
|
277 | + * @param string string |
|
280 | 278 | * @param string $string |
281 | - * @param string $message |
|
282 | - * @return boolean |
|
279 | + * @param string string |
|
280 | + * @return boolean|null |
|
283 | 281 | */ |
284 | 282 | public function assertTextEndsWith($suffix, $string, $message = '') { |
285 | 283 | $suffix = str_replace(array("\r\n", "\r"), "\n", $suffix); |
@@ -291,10 +289,10 @@ discard block |
||
291 | 289 | * Asserts that a string ends not with a given prefix, ignoring differences in newlines. |
292 | 290 | * Helpful for doing cross platform tests of blocks of text. |
293 | 291 | * |
294 | - * @param string $suffix |
|
292 | + * @param string string |
|
295 | 293 | * @param string $string |
296 | - * @param string $message |
|
297 | - * @return boolean |
|
294 | + * @param string string |
|
295 | + * @return boolean|null |
|
298 | 296 | */ |
299 | 297 | public function assertTextEndsNotWith($suffix, $string, $message = '') { |
300 | 298 | $suffix = str_replace(array("\r\n", "\r"), "\n", $suffix); |
@@ -310,7 +308,7 @@ discard block |
||
310 | 308 | * @param string $haystack |
311 | 309 | * @param string $message |
312 | 310 | * @param boolean $ignoreCase |
313 | - * @return boolean |
|
311 | + * @return boolean|null |
|
314 | 312 | */ |
315 | 313 | public function assertTextContains($needle, $haystack, $message = '', $ignoreCase = false) { |
316 | 314 | $needle = str_replace(array("\r\n", "\r"), "\n", $needle); |
@@ -326,7 +324,7 @@ discard block |
||
326 | 324 | * @param string $haystack |
327 | 325 | * @param string $message |
328 | 326 | * @param boolean $ignoreCase |
329 | - * @return boolean |
|
327 | + * @return boolean|null |
|
330 | 328 | */ |
331 | 329 | public function assertTextNotContains($needle, $haystack, $message = '', $ignoreCase = false) { |
332 | 330 | $needle = str_replace(array("\r\n", "\r"), "\n", $needle); |
@@ -373,7 +371,6 @@ discard block |
||
373 | 371 | * |
374 | 372 | * @param string $string An HTML/XHTML/XML string |
375 | 373 | * @param array $expected An array, see above |
376 | - * @param string $message SimpleTest failure output string |
|
377 | 374 | * @return boolean |
378 | 375 | */ |
379 | 376 | public function assertTags($string, $expected, $fullDebug = false) { |
@@ -511,7 +508,7 @@ discard block |
||
511 | 508 | * |
512 | 509 | * @param array $assertions Assertions to run. |
513 | 510 | * @param string $string The HTML string to check. |
514 | - * @return void |
|
511 | + * @return string |
|
515 | 512 | */ |
516 | 513 | protected function _assertAttributes($assertions, $string) { |
517 | 514 | $asserts = $assertions['attrs']; |
@@ -568,7 +565,7 @@ discard block |
||
568 | 565 | /** |
569 | 566 | * Compatibility wrapper function for assertRegexp |
570 | 567 | * |
571 | - * @param mixed $pattern a regular expression |
|
568 | + * @param string $pattern a regular expression |
|
572 | 569 | * @param string $string the text to be matched |
573 | 570 | * @param string $message the text to display if the assertion is not correct |
574 | 571 | * @deprecated This is a compatiblity wrapper for 1.x. It will be removed in 3.0 |
@@ -582,7 +579,7 @@ discard block |
||
582 | 579 | * Compatibility wrapper function for assertEquals |
583 | 580 | * |
584 | 581 | * @param mixed $actual |
585 | - * @param mixed $expected |
|
582 | + * @param integer $expected |
|
586 | 583 | * @param string $message the text to display if the assertion is not correct |
587 | 584 | * @deprecated This is a compatiblity wrapper for 1.x. It will be removed in 3.0 |
588 | 585 | * @return void |
@@ -629,7 +626,7 @@ discard block |
||
629 | 626 | /** |
630 | 627 | * Compatibility wrapper function for setExpectedException |
631 | 628 | * |
632 | - * @param mixed $expected the name of the Exception or error |
|
629 | + * @param string $expected the name of the Exception or error |
|
633 | 630 | * @param string $message the text to display if the assertion is not correct |
634 | 631 | * @deprecated This is a compatiblity wrapper for 1.x. It will be removed in 3.0 |
635 | 632 | * @return void |
@@ -644,7 +641,6 @@ discard block |
||
644 | 641 | /** |
645 | 642 | * Compatibility wrapper function for setExpectedException |
646 | 643 | * |
647 | - * @param mixed $expected the name of the Exception |
|
648 | 644 | * @param string $message the text to display if the assertion is not correct |
649 | 645 | * @deprecated This is a compatiblity wrapper for 1.x. It will be removed in 3.0 |
650 | 646 | * @return void |
@@ -656,8 +652,8 @@ discard block |
||
656 | 652 | /** |
657 | 653 | * Compatibility wrapper function for assertSame |
658 | 654 | * |
659 | - * @param mixed $first |
|
660 | - * @param mixed $second |
|
655 | + * @param FireCake $first |
|
656 | + * @param FireCake $second |
|
661 | 657 | * @param string $message the text to display if the assertion is not correct |
662 | 658 | * @deprecated This is a compatiblity wrapper for 1.x. It will be removed in 3.0 |
663 | 659 | * @return void |
@@ -684,7 +680,7 @@ discard block |
||
684 | 680 | * |
685 | 681 | * @param mixed $result |
686 | 682 | * @param mixed $expected |
687 | - * @param mixed $margin the rage of acceptation |
|
683 | + * @param integer $margin the rage of acceptation |
|
688 | 684 | * @param string $message the text to display if the assertion is not correct |
689 | 685 | * @return void |
690 | 686 | */ |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | * @throws InvalidArgumentException |
77 | 77 | */ |
78 | 78 | public function run(PHPUnit_Framework_TestResult $result = null) { |
79 | - if (!empty($this->fixtureManager)) { |
|
79 | + if ( ! empty($this->fixtureManager)) { |
|
80 | 80 | $this->fixtureManager->load($this); |
81 | 81 | } |
82 | 82 | $result = parent::run($result); |
83 | - if (!empty($this->fixtureManager)) { |
|
83 | + if ( ! empty($this->fixtureManager)) { |
|
84 | 84 | $this->fixtureManager->unload($this); |
85 | 85 | } |
86 | 86 | return $result; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | if (class_exists('ClassRegistry', false)) { |
151 | 151 | ClassRegistry::flush(); |
152 | 152 | } |
153 | - if (!empty($this->_configure)) { |
|
153 | + if ( ! empty($this->_configure)) { |
|
154 | 154 | Configure::clear(); |
155 | 155 | Configure::write($this->_configure); |
156 | 156 | } |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | public function assertTags($string, $expected, $fullDebug = false) { |
380 | 380 | $regex = array(); |
381 | 381 | $normalized = array(); |
382 | - foreach ((array)$expected as $key => $val) { |
|
383 | - if (!is_numeric($key)) { |
|
382 | + foreach ((array) $expected as $key => $val) { |
|
383 | + if ( ! is_numeric($key)) { |
|
384 | 384 | $normalized[] = array($key => $val); |
385 | 385 | } else { |
386 | 386 | $normalized[] = $val; |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | } |
389 | 389 | $i = 0; |
390 | 390 | foreach ($normalized as $tags) { |
391 | - if (!is_array($tags)) { |
|
392 | - $tags = (string)$tags; |
|
391 | + if ( ! is_array($tags)) { |
|
392 | + $tags = (string) $tags; |
|
393 | 393 | } |
394 | 394 | $i++; |
395 | 395 | if (is_string($tags) && $tags{0} === '<') { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | ); |
411 | 411 | continue; |
412 | 412 | } |
413 | - if (!empty($tags) && preg_match('/^preg\:\/(.+)\/$/i', $tags, $matches)) { |
|
413 | + if ( ! empty($tags) && preg_match('/^preg\:\/(.+)\/$/i', $tags, $matches)) { |
|
414 | 414 | $tags = $matches[1]; |
415 | 415 | $type = 'Regex matches'; |
416 | 416 | } else { |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | $attr = $val; |
448 | 448 | $val = '.+?'; |
449 | 449 | $explanations[] = sprintf('Attribute "%s" present', $attr); |
450 | - } elseif (!empty($val) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) { |
|
450 | + } elseif ( ! empty($val) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) { |
|
451 | 451 | $val = str_replace( |
452 | 452 | array('.*', '.+'), |
453 | 453 | array('.*?', '.+?'), |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $explanations[] = sprintf('Attribute "%s" == "%s"', $attr, $val); |
461 | 461 | $val = preg_quote($val, '/'); |
462 | 462 | } |
463 | - $attrs[] = '[\s]+' . preg_quote($attr, '/') . '=' . $quotes . $val . $quotes; |
|
463 | + $attrs[] = '[\s]+'.preg_quote($attr, '/').'='.$quotes.$val.$quotes; |
|
464 | 464 | } |
465 | 465 | $i++; |
466 | 466 | } |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | } |
486 | 486 | |
487 | 487 | list($description, $expressions, $itemNum) = $assertion; |
488 | - foreach ((array)$expressions as $expression) { |
|
488 | + foreach ((array) $expressions as $expression) { |
|
489 | 489 | if (preg_match(sprintf('/^%s/s', $expression), $string, $match)) { |
490 | 490 | $matches = true; |
491 | 491 | $string = substr($string, strlen($match[0])); |
492 | 492 | break; |
493 | 493 | } |
494 | 494 | } |
495 | - if (!$matches) { |
|
495 | + if ( ! $matches) { |
|
496 | 496 | $this->assertTrue(false, sprintf('Item #%d / regex #%d failed: %s', $itemNum, $i, $description)); |
497 | 497 | if ($fullDebug) { |
498 | 498 | debug($string, true); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | } |
530 | 530 | } |
531 | 531 | if ($matches === false) { |
532 | - $this->assertTrue(false, 'Attribute did not match. Was expecting ' . $explains[$j]); |
|
532 | + $this->assertTrue(false, 'Attribute did not match. Was expecting '.$explains[$j]); |
|
533 | 533 | } |
534 | 534 | $len = count($asserts); |
535 | 535 | } while ($len > 0); |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * @return void |
636 | 636 | */ |
637 | 637 | protected function expectError($expected = false, $message = '') { |
638 | - if (!$expected) { |
|
638 | + if ( ! $expected) { |
|
639 | 639 | $expected = 'Exception'; |
640 | 640 | } |
641 | 641 | $this->setExpectedException($expected, $message); |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | * @return boolean |
703 | 703 | */ |
704 | 704 | protected function skipUnless($condition, $message = '') { |
705 | - if (!$condition) { |
|
705 | + if ( ! $condition) { |
|
706 | 706 | $this->markTestSkipped($message); |
707 | 707 | } |
708 | 708 | return $condition; |
@@ -722,10 +722,10 @@ discard block |
||
722 | 722 | $config += ClassRegistry::config('Model'); |
723 | 723 | |
724 | 724 | list($plugin, $name) = pluginSplit($model, true); |
725 | - App::uses($name, $plugin . 'Model'); |
|
726 | - $config = array_merge((array)$config, array('name' => $name)); |
|
725 | + App::uses($name, $plugin.'Model'); |
|
726 | + $config = array_merge((array) $config, array('name' => $name)); |
|
727 | 727 | |
728 | - if (!class_exists($name)) { |
|
728 | + if ( ! class_exists($name)) { |
|
729 | 729 | throw new MissingModelException(array($model)); |
730 | 730 | } |
731 | 731 |
@@ -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 |