@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * Generates a list of the current aro and aco structures and a grid dump of the permissions that are defined |
496 | 496 | * Only designed to work with the db based ACL |
497 | 497 | * |
498 | - * @param boolean $treesToo |
|
498 | + * @param boolean $printTreesToo |
|
499 | 499 | * @return void |
500 | 500 | */ |
501 | 501 | protected function _debug($printTreesToo = false) { |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | * |
544 | 544 | * @param string $string |
545 | 545 | * @param integer $len |
546 | - * @return void |
|
546 | + * @return string |
|
547 | 547 | */ |
548 | 548 | protected function _pad($string = '', $len = 14) { |
549 | 549 | return str_pad($string, $len); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | App::uses('DbAcl', 'Controller/Component/Acl'); |
22 | 22 | App::uses('AclNode', 'Model'); |
23 | 23 | App::uses('Permission', 'Model'); |
24 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . DS . 'Model' . DS . 'models.php'; |
|
24 | +require_once dirname(dirname(dirname(dirname(__FILE__)))).DS.'Model'.DS.'models.php'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * AclNodeTwoTestBase class |
@@ -214,24 +214,24 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function testCreate() { |
216 | 216 | $this->Acl->Aro->create(array('alias' => 'Chotchkey')); |
217 | - $this->assertTrue((bool)$this->Acl->Aro->save()); |
|
217 | + $this->assertTrue((bool) $this->Acl->Aro->save()); |
|
218 | 218 | |
219 | 219 | $parent = $this->Acl->Aro->id; |
220 | 220 | |
221 | 221 | $this->Acl->Aro->create(array('parent_id' => $parent, 'alias' => 'Joanna')); |
222 | - $this->assertTrue((bool)$this->Acl->Aro->save()); |
|
222 | + $this->assertTrue((bool) $this->Acl->Aro->save()); |
|
223 | 223 | |
224 | 224 | $this->Acl->Aro->create(array('parent_id' => $parent, 'alias' => 'Stapler')); |
225 | - $this->assertTrue((bool)$this->Acl->Aro->save()); |
|
225 | + $this->assertTrue((bool) $this->Acl->Aro->save()); |
|
226 | 226 | |
227 | 227 | $root = $this->Acl->Aco->node('ROOT'); |
228 | 228 | $parent = $root[0]['AcoTwoTest']['id']; |
229 | 229 | |
230 | 230 | $this->Acl->Aco->create(array('parent_id' => $parent, 'alias' => 'Drinks')); |
231 | - $this->assertTrue((bool)$this->Acl->Aco->save()); |
|
231 | + $this->assertTrue((bool) $this->Acl->Aco->save()); |
|
232 | 232 | |
233 | 233 | $this->Acl->Aco->create(array('parent_id' => $parent, 'alias' => 'PiecesOfFlair')); |
234 | - $this->assertTrue((bool)$this->Acl->Aco->save()); |
|
234 | + $this->assertTrue((bool) $this->Acl->Aco->save()); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -119,6 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * construct method |
121 | 121 | * |
122 | + * @param CakeRequest $request |
|
122 | 123 | */ |
123 | 124 | public function __construct($request, $response) { |
124 | 125 | $request->addParams(Router::parse('/auth_test')); |
@@ -184,7 +185,7 @@ discard block |
||
184 | 185 | * @param string|array $url |
185 | 186 | * @param mixed $status |
186 | 187 | * @param mixed $exit |
187 | - * @return void |
|
188 | + * @return boolean |
|
188 | 189 | */ |
189 | 190 | public function redirect($url, $status = null, $exit = true) { |
190 | 191 | $this->testUrl = Router::url($url); |
@@ -257,7 +258,7 @@ discard block |
||
257 | 258 | * @param string|array $url |
258 | 259 | * @param mixed $status |
259 | 260 | * @param mixed $exit |
260 | - * @return void |
|
261 | + * @return boolean |
|
261 | 262 | */ |
262 | 263 | public function redirect($url, $status = null, $exit = true) { |
263 | 264 | $this->testUrl = Router::url($url); |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | $pref = Configure::read('Routing.prefixes'); |
1091 | 1091 | Configure::write('Routing.prefixes', array('admin')); |
1092 | 1092 | Router::reload(); |
1093 | - require CAKE . 'Config' . DS . 'routes.php'; |
|
1093 | + require CAKE.'Config'.DS.'routes.php'; |
|
1094 | 1094 | |
1095 | 1095 | $url = '/admin/auth_test/add'; |
1096 | 1096 | $this->Auth->request->addParams(Router::parse($url)); |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | */ |
1118 | 1118 | public function testAjaxLogin() { |
1119 | 1119 | App::build(array( |
1120 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
1120 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
1121 | 1121 | )); |
1122 | 1122 | $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; |
1123 | 1123 | |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | $admin = Configure::read('Routing.prefixes'); |
1142 | 1142 | Configure::write('Routing.prefixes', array('admin')); |
1143 | 1143 | Router::reload(); |
1144 | - require CAKE . 'Config' . DS . 'routes.php'; |
|
1144 | + require CAKE.'Config'.DS.'routes.php'; |
|
1145 | 1145 | |
1146 | 1146 | $url = '/admin/auth_test/login'; |
1147 | 1147 | $this->Auth->request->addParams(Router::parse($url)); |
@@ -86,8 +86,7 @@ |
||
86 | 86 | /** |
87 | 87 | * find method |
88 | 88 | * |
89 | - * @param mixed $type |
|
90 | - * @param array $options |
|
89 | + * @param array $conditions |
|
91 | 90 | * @return void |
92 | 91 | */ |
93 | 92 | public function find($conditions = null, $fields = array(), $order = null, $recursive = null) { |
@@ -1029,10 +1029,10 @@ discard block |
||
1029 | 1029 | $this->assertEquals('desc', $result['order']['Child.something']); |
1030 | 1030 | } |
1031 | 1031 | /** |
1032 | - * test that multiple sort works. |
|
1033 | - * |
|
1034 | - * @return void |
|
1035 | - */ |
|
1032 | + * test that multiple sort works. |
|
1033 | + * |
|
1034 | + * @return void |
|
1035 | + */ |
|
1036 | 1036 | public function testValidateSortMultiple() { |
1037 | 1037 | $model = $this->getMock('Model'); |
1038 | 1038 | $model->alias = 'model'; |
@@ -1233,10 +1233,10 @@ discard block |
||
1233 | 1233 | $this->assertFalse($result['prevPage']); |
1234 | 1234 | } |
1235 | 1235 | /** |
1236 | - * test paginate() and custom find with fields array, to make sure the correct count is returned. |
|
1237 | - * |
|
1238 | - * @return void |
|
1239 | - */ |
|
1236 | + * test paginate() and custom find with fields array, to make sure the correct count is returned. |
|
1237 | + * |
|
1238 | + * @return void |
|
1239 | + */ |
|
1240 | 1240 | public function testPaginateCustomFindFieldsArray() { |
1241 | 1241 | $Controller = new Controller($this->request); |
1242 | 1242 | $Controller->uses = array('PaginatorCustomPost'); |
@@ -1265,10 +1265,10 @@ discard block |
||
1265 | 1265 | $this->assertFalse($result['prevPage']); |
1266 | 1266 | } |
1267 | 1267 | /** |
1268 | - * test paginate() and custom find with customFind key, to make sure the correct count is returned. |
|
1269 | - * |
|
1270 | - * @return void |
|
1271 | - */ |
|
1268 | + * test paginate() and custom find with customFind key, to make sure the correct count is returned. |
|
1269 | + * |
|
1270 | + * @return void |
|
1271 | + */ |
|
1272 | 1272 | public function testPaginateCustomFindWithCustomFindKey() { |
1273 | 1273 | $Controller = new Controller($this->request); |
1274 | 1274 | $Controller->uses = array('PaginatorCustomPost'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function find($conditions = null, $fields = array(), $order = null, $recursive = null) { |
94 | 94 | if ($conditions === 'popular') { |
95 | - $conditions = array($this->name . '.' . $this->primaryKey . ' > ' => '1'); |
|
95 | + $conditions = array($this->name.'.'.$this->primaryKey.' > ' => '1'); |
|
96 | 96 | $options = Hash::merge($fields, compact('conditions')); |
97 | 97 | return parent::find('all', $options); |
98 | 98 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | protected function _findTotalsOperation($state, $query, $results = array()) { |
262 | 262 | if ($state === 'before') { |
263 | - if (!empty($query['operation']) && $query['operation'] === 'count') { |
|
263 | + if ( ! empty($query['operation']) && $query['operation'] === 'count') { |
|
264 | 264 | unset($query['limit']); |
265 | 265 | $query['recursive'] = -1; |
266 | 266 | $query['fields'] = array('COUNT(DISTINCT author_id) AS count'); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $result = $Controller->Paginator->paginate('PaginatorControllerPost'); |
453 | 453 | $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']); |
454 | 454 | $this->assertEquals(array(1, 2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id')); |
455 | - $this->assertTrue(!isset($Controller->PaginatorControllerPost->lastQueries[1]['contain'])); |
|
455 | + $this->assertTrue( ! isset($Controller->PaginatorControllerPost->lastQueries[1]['contain'])); |
|
456 | 456 | |
457 | 457 | $Controller->request->params['named'] = array('page' => '-1'); |
458 | 458 | $Controller->Paginator->settings = array( |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | $Controller->params['url'] = array(); |
589 | 589 | $Controller->constructClasses(); |
590 | 590 | $Controller->PaginatorControllerPost->order = array( |
591 | - $Controller->PaginatorControllerPost->alias . '.created' => 'desc' |
|
591 | + $Controller->PaginatorControllerPost->alias.'.created' => 'desc' |
|
592 | 592 | ); |
593 | 593 | |
594 | 594 | $Controller->Paginator->settings = array( |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $data = array('author_id' => 3, 'title' => 'Fourth Article', 'body' => 'Article Body, unpublished', 'published' => 'N'); |
1205 | 1205 | $Controller->PaginatorCustomPost->create($data); |
1206 | 1206 | $result = $Controller->PaginatorCustomPost->save(); |
1207 | - $this->assertTrue(!empty($result)); |
|
1207 | + $this->assertTrue( ! empty($result)); |
|
1208 | 1208 | |
1209 | 1209 | $result = $Controller->paginate(); |
1210 | 1210 | $this->assertEquals(array(1, 2, 3, 4), Hash::extract($result, '{n}.PaginatorCustomPost.id')); |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | $data = array('author_id' => 3, 'title' => 'Fourth Article', 'body' => 'Article Body, unpublished', 'published' => 'N'); |
1245 | 1245 | $Controller->PaginatorCustomPost->create($data); |
1246 | 1246 | $result = $Controller->PaginatorCustomPost->save(); |
1247 | - $this->assertTrue(!empty($result)); |
|
1247 | + $this->assertTrue( ! empty($result)); |
|
1248 | 1248 | |
1249 | 1249 | $Controller->paginate = array( |
1250 | 1250 | 'list', |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | $data = array('author_id' => 3, 'title' => 'Fourth Article', 'body' => 'Article Body, unpublished', 'published' => 'N'); |
1277 | 1277 | $Controller->PaginatorCustomPost->create($data); |
1278 | 1278 | $result = $Controller->PaginatorCustomPost->save(); |
1279 | - $this->assertTrue(!empty($result)); |
|
1279 | + $this->assertTrue( ! empty($result)); |
|
1280 | 1280 | |
1281 | 1281 | $Controller->paginate = array( |
1282 | 1282 | 'conditions' => array('PaginatorCustomPost.published' => 'Y'), |
@@ -1309,7 +1309,7 @@ discard block |
||
1309 | 1309 | $data = array('author_id' => 2, 'title' => 'Fourth Article', 'body' => 'Article Body, unpublished', 'published' => 'N'); |
1310 | 1310 | $Controller->PaginatorCustomPost->create($data); |
1311 | 1311 | $result = $Controller->PaginatorCustomPost->save(); |
1312 | - $this->assertTrue(!empty($result)); |
|
1312 | + $this->assertTrue( ! empty($result)); |
|
1313 | 1313 | |
1314 | 1314 | $Controller->paginate = array( |
1315 | 1315 | 'totals', |
@@ -1374,7 +1374,7 @@ discard block |
||
1374 | 1374 | $data = array('author_id' => 2, 'title' => 'Fourth Article', 'body' => 'Article Body, unpublished', 'published' => 'N'); |
1375 | 1375 | $Controller->PaginatorCustomPost->create($data); |
1376 | 1376 | $result = $Controller->PaginatorCustomPost->save(); |
1377 | - $this->assertTrue(!empty($result)); |
|
1377 | + $this->assertTrue( ! empty($result)); |
|
1378 | 1378 | |
1379 | 1379 | $Controller->paginate = array( |
1380 | 1380 | 'totalsOperation', |
@@ -79,7 +79,6 @@ |
||
79 | 79 | * redirect method |
80 | 80 | * |
81 | 81 | * @param string|array $url |
82 | - * @param mixed $code |
|
83 | 82 | * @param mixed $exit |
84 | 83 | * @return void |
85 | 84 | */ |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SecurityComponentTest 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.Controller.Component |
|
15 | - * @since CakePHP(tm) v 1.2.0.5435 |
|
16 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
17 | - */ |
|
3 | + * SecurityComponentTest 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.Controller.Component |
|
15 | + * @since CakePHP(tm) v 1.2.0.5435 |
|
16 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
17 | + */ |
|
18 | 18 | |
19 | 19 | App::uses('SecurityComponent', 'Controller/Component'); |
20 | 20 | App::uses('Controller', 'Controller'); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | |
551 | 551 | // a corrupted serialized object, so we can see if it ever gets to deserialize |
552 | 552 | $attack = 'O:3:"App":1:{s:5:"__map";a:1:{s:3:"foo";s:7:"Hacked!";s:1:"fail"}}'; |
553 | - $fields .= urlencode(':' . str_rot13($attack)); |
|
553 | + $fields .= urlencode(':'.str_rot13($attack)); |
|
554 | 554 | |
555 | 555 | $this->Controller->request->data = array( |
556 | 556 | 'Model' => array('username' => 'mark', 'password' => 'foo', 'valid' => '0'), |
@@ -794,9 +794,9 @@ discard block |
||
794 | 794 | $unlocked = 'Model.username'; |
795 | 795 | $fields = array('Model.hidden', 'Model.password'); |
796 | 796 | $fields = urlencode(Security::hash( |
797 | - '/posts/index' . |
|
798 | - serialize($fields) . |
|
799 | - $unlocked . |
|
797 | + '/posts/index'. |
|
798 | + serialize($fields). |
|
799 | + $unlocked. |
|
800 | 800 | Configure::read('Security.salt')) |
801 | 801 | ); |
802 | 802 | |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | $this->Controller->Security->startup($this->Controller); |
823 | 823 | $key = $this->Controller->request->params['_Token']['key']; |
824 | 824 | $fields = array('Model.hidden', 'Model.password', 'Model.username'); |
825 | - $fields = urlencode(Security::hash(serialize($fields) . Configure::read('Security.salt'))); |
|
825 | + $fields = urlencode(Security::hash(serialize($fields).Configure::read('Security.salt'))); |
|
826 | 826 | |
827 | 827 | $this->Controller->request->data = array( |
828 | 828 | 'Model' => array( |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | $key = $this->Controller->request->params['_Token']['key']; |
848 | 848 | $unlocked = 'Model.username'; |
849 | 849 | $fields = array('Model.hidden', 'Model.password'); |
850 | - $fields = urlencode(Security::hash(serialize($fields) . $unlocked . Configure::read('Security.salt'))); |
|
850 | + $fields = urlencode(Security::hash(serialize($fields).$unlocked.Configure::read('Security.salt'))); |
|
851 | 851 | |
852 | 852 | // Tamper the values. |
853 | 853 | $unlocked = 'Model.username|Model.password'; |
@@ -970,9 +970,9 @@ discard block |
||
970 | 970 | $hashFields = array('TaxonomyData'); |
971 | 971 | $fields = urlencode( |
972 | 972 | Security::hash( |
973 | - '/posts/index' . |
|
974 | - serialize($hashFields) . |
|
975 | - $unlocked . |
|
973 | + '/posts/index'. |
|
974 | + serialize($hashFields). |
|
975 | + $unlocked. |
|
976 | 976 | Configure::read('Security.salt'), 'sha1') |
977 | 977 | ); |
978 | 978 |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * index method |
236 | 236 | * |
237 | 237 | * @param mixed $testId |
238 | - * @param mixed $test2Id |
|
238 | + * @param mixed $testTwoId |
|
239 | 239 | * @return void |
240 | 240 | */ |
241 | 241 | public function index($testId, $testTwoId) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * view method |
250 | 250 | * |
251 | 251 | * @param mixed $testId |
252 | - * @param mixed $test2Id |
|
252 | + * @param mixed $testTwoId |
|
253 | 253 | * @return void |
254 | 254 | */ |
255 | 255 | public function view($testId, $testTwoId) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function find($type = 'first', $options = array()) { |
99 | 99 | if ($type === 'popular') { |
100 | - $conditions = array($this->name . '.' . $this->primaryKey . ' > ' => '1'); |
|
100 | + $conditions = array($this->name.'.'.$this->primaryKey.' > ' => '1'); |
|
101 | 101 | $options = Hash::merge($options, compact('conditions')); |
102 | 102 | return parent::find('all', $options); |
103 | 103 | } |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | */ |
449 | 449 | public function testLoadModelInPlugins() { |
450 | 450 | App::build(array( |
451 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), |
|
452 | - 'Controller' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS), |
|
453 | - 'Model' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS) |
|
451 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS), |
|
452 | + 'Controller' => array(CAKE.'Test'.DS.'test_app'.DS.'Controller'.DS), |
|
453 | + 'Model' => array(CAKE.'Test'.DS.'test_app'.DS.'Model'.DS) |
|
454 | 454 | )); |
455 | 455 | CakePlugin::load('TestPlugin'); |
456 | 456 | App::uses('TestPluginAppController', 'TestPlugin.Controller'); |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | unset($Controller); |
491 | 491 | |
492 | - App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS))); |
|
492 | + App::build(array('Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS))); |
|
493 | 493 | CakePlugin::load('TestPlugin'); |
494 | 494 | |
495 | 495 | $Controller = new Controller($request); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $this->assertEquals($expected, $result); |
568 | 568 | |
569 | 569 | App::build(array( |
570 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
570 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
571 | 571 | )); |
572 | 572 | $Controller = new Controller($request); |
573 | 573 | $Controller->response = $this->getMock('CakeResponse', array('_sendHeader')); |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | */ |
627 | 627 | public function testRender() { |
628 | 628 | App::build(array( |
629 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
629 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
630 | 630 | ), App::RESET); |
631 | 631 | ClassRegistry::flush(); |
632 | 632 | $request = new CakeRequest('controller_posts/index'); |
@@ -636,14 +636,14 @@ discard block |
||
636 | 636 | $Controller->viewPath = 'Posts'; |
637 | 637 | |
638 | 638 | $result = $Controller->render('index'); |
639 | - $this->assertRegExp('/posts index/', (string)$result); |
|
639 | + $this->assertRegExp('/posts index/', (string) $result); |
|
640 | 640 | |
641 | 641 | $Controller->view = 'index'; |
642 | 642 | $result = $Controller->render(); |
643 | - $this->assertRegExp('/posts index/', (string)$result); |
|
643 | + $this->assertRegExp('/posts index/', (string) $result); |
|
644 | 644 | |
645 | 645 | $result = $Controller->render('/Elements/test_element'); |
646 | - $this->assertRegExp('/this is the test element/', (string)$result); |
|
646 | + $this->assertRegExp('/this is the test element/', (string) $result); |
|
647 | 647 | $Controller->view = null; |
648 | 648 | |
649 | 649 | $Controller = new TestController($request, new CakeResponse()); |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | public function testComponentBeforeRenderChangingViewClass() { |
679 | 679 | App::build(array( |
680 | 680 | 'View' => array( |
681 | - CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS |
|
681 | + CAKE.'Test'.DS.'test_app'.DS.'View'.DS |
|
682 | 682 | ) |
683 | 683 | ), true); |
684 | 684 | $Controller = new Controller($this->getMock('CakeRequest'), new CakeResponse()); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $Controller->viewPath = 'Posts'; |
690 | 690 | $Controller->theme = 'TestTheme'; |
691 | 691 | $result = $Controller->render('index'); |
692 | - $this->assertRegExp('/default test_theme layout/', (string)$result); |
|
692 | + $this->assertRegExp('/default test_theme layout/', (string) $result); |
|
693 | 693 | App::build(); |
694 | 694 | } |
695 | 695 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | $Controller->response->expects($this->once())->method('header') |
758 | 758 | ->with('Location', 'http://cakephp.org'); |
759 | 759 | |
760 | - $Controller->redirect('http://cakephp.org', (int)$code, false); |
|
760 | + $Controller->redirect('http://cakephp.org', (int) $code, false); |
|
761 | 761 | $this->assertFalse($Controller->autoRender); |
762 | 762 | } |
763 | 763 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | $components = is_array($appVars['components']) |
923 | 923 | ? array_merge($appVars['components'], $testVars['components']) |
924 | 924 | : $testVars['components']; |
925 | - if (!in_array('Session', $components)) { |
|
925 | + if ( ! in_array('Session', $components)) { |
|
926 | 926 | $components[] = 'Session'; |
927 | 927 | } |
928 | 928 | $helpers = is_array($appVars['helpers']) |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * test_request_action method |
55 | 55 | * |
56 | - * @return void |
|
56 | + * @return string |
|
57 | 57 | */ |
58 | 58 | public function test_request_action() { |
59 | 59 | return 'This is a test'; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * normal_request_action method |
75 | 75 | * |
76 | - * @return void |
|
76 | + * @return string |
|
77 | 77 | */ |
78 | 78 | public function normal_request_action() { |
79 | 79 | return 'Hello World'; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * paginate_request_action method |
93 | 93 | * |
94 | - * @return void |
|
94 | + * @return boolean |
|
95 | 95 | */ |
96 | 96 | public function paginate_request_action() { |
97 | 97 | $this->paginate(); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | /** |
111 | 111 | * test param passing and parsing. |
112 | 112 | * |
113 | - * @return array |
|
113 | + * @return CakeRequest |
|
114 | 114 | */ |
115 | 115 | public function params_pass() { |
116 | 116 | return $this->request; |
@@ -313,28 +313,28 @@ discard block |
||
313 | 313 | * @return void |
314 | 314 | */ |
315 | 315 | public function testLog() { |
316 | - if (file_exists(LOGS . 'error.log')) { |
|
317 | - unlink(LOGS . 'error.log'); |
|
316 | + if (file_exists(LOGS.'error.log')) { |
|
317 | + unlink(LOGS.'error.log'); |
|
318 | 318 | } |
319 | 319 | $this->assertTrue($this->object->log('Test warning 1')); |
320 | 320 | $this->assertTrue($this->object->log(array('Test' => 'warning 2'))); |
321 | - $result = file(LOGS . 'error.log'); |
|
321 | + $result = file(LOGS.'error.log'); |
|
322 | 322 | $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Test warning 1$/', $result[0]); |
323 | 323 | $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Array$/', $result[1]); |
324 | 324 | $this->assertRegExp('/^\($/', $result[2]); |
325 | 325 | $this->assertRegExp('/\[Test\] => warning 2$/', $result[3]); |
326 | 326 | $this->assertRegExp('/^\)$/', $result[4]); |
327 | - unlink(LOGS . 'error.log'); |
|
327 | + unlink(LOGS.'error.log'); |
|
328 | 328 | |
329 | 329 | $this->assertTrue($this->object->log('Test warning 1', LOG_WARNING)); |
330 | 330 | $this->assertTrue($this->object->log(array('Test' => 'warning 2'), LOG_WARNING)); |
331 | - $result = file(LOGS . 'error.log'); |
|
331 | + $result = file(LOGS.'error.log'); |
|
332 | 332 | $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]); |
333 | 333 | $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Array$/', $result[1]); |
334 | 334 | $this->assertRegExp('/^\($/', $result[2]); |
335 | 335 | $this->assertRegExp('/\[Test\] => warning 2$/', $result[3]); |
336 | 336 | $this->assertRegExp('/^\)$/', $result[4]); |
337 | - unlink(LOGS . 'error.log'); |
|
337 | + unlink(LOGS.'error.log'); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -440,9 +440,9 @@ discard block |
||
440 | 440 | */ |
441 | 441 | public function testRequestAction() { |
442 | 442 | App::build(array( |
443 | - 'Model' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS), |
|
444 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS), |
|
445 | - 'Controller' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS) |
|
443 | + 'Model' => array(CAKE.'Test'.DS.'test_app'.DS.'Model'.DS), |
|
444 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS), |
|
445 | + 'Controller' => array(CAKE.'Test'.DS.'test_app'.DS.'Controller'.DS) |
|
446 | 446 | ), App::RESET); |
447 | 447 | $this->assertNull(Router::getRequest(), 'request stack should be empty.'); |
448 | 448 | |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $this->assertEquals($expected, $result); |
455 | 455 | |
456 | 456 | $result = $this->object->requestAction( |
457 | - Configure::read('App.fullBaseUrl') . '/request_action/test_request_action' |
|
457 | + Configure::read('App.fullBaseUrl').'/request_action/test_request_action' |
|
458 | 458 | ); |
459 | 459 | $expected = 'This is a test'; |
460 | 460 | $this->assertEquals($expected, $result); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | */ |
489 | 489 | public function testRequestActionPlugins() { |
490 | 490 | App::build(array( |
491 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), |
|
491 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS), |
|
492 | 492 | ), App::RESET); |
493 | 493 | CakePlugin::load('TestPlugin'); |
494 | 494 | Router::reload(); |
@@ -525,10 +525,10 @@ discard block |
||
525 | 525 | */ |
526 | 526 | public function testRequestActionArray() { |
527 | 527 | App::build(array( |
528 | - 'Model' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS), |
|
529 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS), |
|
530 | - 'Controller' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS), |
|
531 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
528 | + 'Model' => array(CAKE.'Test'.DS.'test_app'.DS.'Model'.DS), |
|
529 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS), |
|
530 | + 'Controller' => array(CAKE.'Test'.DS.'test_app'.DS.'Controller'.DS), |
|
531 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
532 | 532 | ), App::RESET); |
533 | 533 | CakePlugin::load(array('TestPlugin')); |
534 | 534 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * index method |
96 | 96 | * |
97 | - * @return void |
|
97 | + * @return string |
|
98 | 98 | */ |
99 | 99 | public function index() { |
100 | 100 | $this->autoRender = false; |
@@ -174,6 +174,7 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * Mocks out the response on the ExceptionRenderer object so headers aren't modified. |
176 | 176 | * |
177 | + * @param ExceptionRenderer $error |
|
177 | 178 | * @return void |
178 | 179 | */ |
179 | 180 | protected function _mockResponse($error) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | Configure::write('Config.language', 'eng'); |
149 | 149 | App::build(array( |
150 | 150 | 'View' => array( |
151 | - CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS |
|
151 | + CAKE.'Test'.DS.'test_app'.DS.'View'.DS |
|
152 | 152 | ) |
153 | 153 | ), App::RESET); |
154 | 154 | Router::reload(); |
@@ -274,19 +274,19 @@ discard block |
||
274 | 274 | * @return void |
275 | 275 | */ |
276 | 276 | public function testCakeErrorHelpersNotLost() { |
277 | - $testApp = CAKE . 'Test' . DS . 'test_app' . DS; |
|
277 | + $testApp = CAKE.'Test'.DS.'test_app'.DS; |
|
278 | 278 | App::build(array( |
279 | 279 | 'Controller' => array( |
280 | - $testApp . 'Controller' . DS |
|
280 | + $testApp.'Controller'.DS |
|
281 | 281 | ), |
282 | 282 | 'View/Helper' => array( |
283 | - $testApp . 'View' . DS . 'Helper' . DS |
|
283 | + $testApp.'View'.DS.'Helper'.DS |
|
284 | 284 | ), |
285 | 285 | 'View/Layouts' => array( |
286 | - $testApp . 'View' . DS . 'Layouts' . DS |
|
286 | + $testApp.'View'.DS.'Layouts'.DS |
|
287 | 287 | ), |
288 | 288 | 'Error' => array( |
289 | - $testApp . 'Error' . DS |
|
289 | + $testApp.'Error'.DS |
|
290 | 290 | ), |
291 | 291 | ), App::RESET); |
292 | 292 |
@@ -1877,7 +1877,7 @@ discard block |
||
1877 | 1877 | /** |
1878 | 1878 | * Singular method |
1879 | 1879 | * |
1880 | - * @return void |
|
1880 | + * @return null|string |
|
1881 | 1881 | */ |
1882 | 1882 | protected function _domainCategorySingular($domain = 'test_plugin', $category = 3) { |
1883 | 1883 | $singular = __dc($domain, 'Plural Rule 1', $category); |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | /** |
1901 | 1901 | * Singular method |
1902 | 1902 | * |
1903 | - * @return void |
|
1903 | + * @return null|string |
|
1904 | 1904 | */ |
1905 | 1905 | protected function _domainSingular($domain = 'test_plugin') { |
1906 | 1906 | $singular = __d($domain, 'Plural Rule 1'); |
@@ -1923,7 +1923,7 @@ discard block |
||
1923 | 1923 | /** |
1924 | 1924 | * category method |
1925 | 1925 | * |
1926 | - * @return void |
|
1926 | + * @return null|string |
|
1927 | 1927 | */ |
1928 | 1928 | protected function _category($category = 3) { |
1929 | 1929 | $singular = __c('Plural Rule 1', $category); |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | /** |
1934 | 1934 | * Singular method |
1935 | 1935 | * |
1936 | - * @return void |
|
1936 | + * @return null|string |
|
1937 | 1937 | */ |
1938 | 1938 | protected function _singular() { |
1939 | 1939 | $singular = __('Plural Rule 1'); |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | /** |
1957 | 1957 | * singularFromCore method |
1958 | 1958 | * |
1959 | - * @return void |
|
1959 | + * @return null|string |
|
1960 | 1960 | */ |
1961 | 1961 | protected function _singularFromCore() { |
1962 | 1962 | $singular = __('Plural Rule 1 (from core)'); |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * I18nTest 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.I18n |
|
15 | - * @since CakePHP(tm) v 1.2.0.5432 |
|
16 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
17 | - */ |
|
3 | + * I18nTest 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.I18n |
|
15 | + * @since CakePHP(tm) v 1.2.0.5432 |
|
16 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
17 | + */ |
|
18 | 18 | |
19 | 19 | App::uses('I18n', 'I18n'); |
20 | 20 |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | Cache::delete('object_map', '_cake_core_'); |
37 | 37 | App::build(array( |
38 | - 'Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS), |
|
39 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
38 | + 'Locale' => array(CAKE.'Test'.DS.'test_app'.DS.'Locale'.DS), |
|
39 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
40 | 40 | ), App::RESET); |
41 | 41 | CakePlugin::load(array('TestPlugin')); |
42 | 42 | } |
@@ -80,23 +80,23 @@ discard block |
||
80 | 80 | I18n::clear(); |
81 | 81 | |
82 | 82 | // now only dom1 should be in cache |
83 | - $cachedDom1 = Cache::read('dom1_' . $lang, '_cake_core_'); |
|
83 | + $cachedDom1 = Cache::read('dom1_'.$lang, '_cake_core_'); |
|
84 | 84 | $this->assertEquals('Dom 1 Foo', $cachedDom1['LC_MESSAGES']['dom1.foo']); |
85 | 85 | $this->assertEquals('Dom 1 Bar', $cachedDom1['LC_MESSAGES']['dom1.bar']); |
86 | 86 | // dom2 not in cache |
87 | - $this->assertFalse(Cache::read('dom2_' . $lang, '_cake_core_')); |
|
87 | + $this->assertFalse(Cache::read('dom2_'.$lang, '_cake_core_')); |
|
88 | 88 | |
89 | 89 | // translate a item of dom2 (adds dom2 to cache) |
90 | 90 | $this->assertEquals('Dom 2 Foo', I18n::translate('dom2.foo', false, 'dom2')); |
91 | 91 | |
92 | 92 | // verify dom2 was cached through manual read from cache |
93 | - $cachedDom2 = Cache::read('dom2_' . $lang, '_cake_core_'); |
|
93 | + $cachedDom2 = Cache::read('dom2_'.$lang, '_cake_core_'); |
|
94 | 94 | $this->assertEquals('Dom 2 Foo', $cachedDom2['LC_MESSAGES']['dom2.foo']); |
95 | 95 | $this->assertEquals('Dom 2 Bar', $cachedDom2['LC_MESSAGES']['dom2.bar']); |
96 | 96 | |
97 | 97 | // modify cache entry manually to verify that dom1 entries now will be read from cache |
98 | 98 | $cachedDom1['LC_MESSAGES']['dom1.foo'] = 'FOO'; |
99 | - Cache::write('dom1_' . $lang, $cachedDom1, '_cake_core_'); |
|
99 | + Cache::write('dom1_'.$lang, $cachedDom1, '_cake_core_'); |
|
100 | 100 | $this->assertEquals('FOO', I18n::translate('dom1.foo', false, 'dom1')); |
101 | 101 | } |
102 | 102 | |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | */ |
1601 | 1601 | public function testPluginTranslation() { |
1602 | 1602 | App::build(array( |
1603 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
1603 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
1604 | 1604 | )); |
1605 | 1605 | |
1606 | 1606 | Configure::write('Config.language', 'po'); |
@@ -1680,15 +1680,15 @@ discard block |
||
1680 | 1680 | $string .= "This is the third line.\n"; |
1681 | 1681 | $string .= "This is the forth line."; |
1682 | 1682 | |
1683 | - $singular = "%d = 1\n" . $string; |
|
1684 | - $plural = "%d = 0 or > 1\n" . $string; |
|
1683 | + $singular = "%d = 1\n".$string; |
|
1684 | + $plural = "%d = 0 or > 1\n".$string; |
|
1685 | 1685 | |
1686 | 1686 | $result = __n($singular, $plural, 1); |
1687 | - $expected = "%d is 1\n" . $string; |
|
1687 | + $expected = "%d is 1\n".$string; |
|
1688 | 1688 | $this->assertEquals($expected, $result); |
1689 | 1689 | |
1690 | 1690 | $result = __n($singular, $plural, 2); |
1691 | - $expected = "%d is 2-4\n" . $string; |
|
1691 | + $expected = "%d is 2-4\n".$string; |
|
1692 | 1692 | $this->assertEquals($expected, $result); |
1693 | 1693 | |
1694 | 1694 | // Windows Newline is \r\n |
@@ -1697,15 +1697,15 @@ discard block |
||
1697 | 1697 | $string .= "This is the third line.\r\n"; |
1698 | 1698 | $string .= "This is the forth line."; |
1699 | 1699 | |
1700 | - $singular = "%d = 1\r\n" . $string; |
|
1701 | - $plural = "%d = 0 or > 1\r\n" . $string; |
|
1700 | + $singular = "%d = 1\r\n".$string; |
|
1701 | + $plural = "%d = 0 or > 1\r\n".$string; |
|
1702 | 1702 | |
1703 | 1703 | $result = __n($singular, $plural, 1); |
1704 | - $expected = "%d is 1\n" . str_replace("\r\n", "\n", $string); |
|
1704 | + $expected = "%d is 1\n".str_replace("\r\n", "\n", $string); |
|
1705 | 1705 | $this->assertEquals($expected, $result); |
1706 | 1706 | |
1707 | 1707 | $result = __n($singular, $plural, 2); |
1708 | - $expected = "%d is 2-4\n" . str_replace("\r\n", "\n", $string); |
|
1708 | + $expected = "%d is 2-4\n".str_replace("\r\n", "\n", $string); |
|
1709 | 1709 | $this->assertEquals($expected, $result); |
1710 | 1710 | } |
1711 | 1711 | |
@@ -1739,15 +1739,15 @@ discard block |
||
1739 | 1739 | public function testFloatValue() { |
1740 | 1740 | Configure::write('Config.language', 'rule_9_po'); |
1741 | 1741 | |
1742 | - $result = __n('%d = 1', '%d = 0 or > 1', (float)1); |
|
1742 | + $result = __n('%d = 1', '%d = 0 or > 1', (float) 1); |
|
1743 | 1743 | $expected = '%d is 1 (translated)'; |
1744 | 1744 | $this->assertEquals($expected, $result); |
1745 | 1745 | |
1746 | - $result = __n('%d = 1', '%d = 0 or > 1', (float)2); |
|
1746 | + $result = __n('%d = 1', '%d = 0 or > 1', (float) 2); |
|
1747 | 1747 | $expected = "%d ends in 2-4, not 12-14 (translated)"; |
1748 | 1748 | $this->assertEquals($expected, $result); |
1749 | 1749 | |
1750 | - $result = __n('%d = 1', '%d = 0 or > 1', (float)5); |
|
1750 | + $result = __n('%d = 1', '%d = 0 or > 1', (float) 5); |
|
1751 | 1751 | $expected = "%d everything else (translated)"; |
1752 | 1752 | $this->assertEquals($expected, $result); |
1753 | 1753 | } |
@@ -1869,7 +1869,7 @@ discard block |
||
1869 | 1869 | */ |
1870 | 1870 | public function testLoadLocaleDefinition() { |
1871 | 1871 | $path = current(App::path('locales')); |
1872 | - $result = I18n::loadLocaleDefinition($path . 'nld' . DS . 'LC_TIME'); |
|
1872 | + $result = I18n::loadLocaleDefinition($path.'nld'.DS.'LC_TIME'); |
|
1873 | 1873 | $expected = array('zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'); |
1874 | 1874 | $this->assertSame($expected, $result['day']); |
1875 | 1875 | } |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | protected function _domainCategoryPlural($domain = 'test_plugin', $category = 3) { |
1893 | 1893 | $plurals = array(); |
1894 | 1894 | for ($number = 0; $number <= 25; $number++) { |
1895 | - $plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category), (float)$number); |
|
1895 | + $plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float) $number, $category), (float) $number); |
|
1896 | 1896 | } |
1897 | 1897 | return $plurals; |
1898 | 1898 | } |
@@ -1915,7 +1915,7 @@ discard block |
||
1915 | 1915 | protected function _domainPlural($domain = 'test_plugin') { |
1916 | 1916 | $plurals = array(); |
1917 | 1917 | for ($number = 0; $number <= 25; $number++) { |
1918 | - $plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); |
|
1918 | + $plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float) $number), (float) $number); |
|
1919 | 1919 | } |
1920 | 1920 | return $plurals; |
1921 | 1921 | } |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | protected function _plural() { |
1949 | 1949 | $plurals = array(); |
1950 | 1950 | for ($number = 0; $number <= 25; $number++) { |
1951 | - $plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); |
|
1951 | + $plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float) $number), (float) $number); |
|
1952 | 1952 | } |
1953 | 1953 | return $plurals; |
1954 | 1954 | } |
@@ -1971,7 +1971,7 @@ discard block |
||
1971 | 1971 | protected function _pluralFromCore() { |
1972 | 1972 | $plurals = array(); |
1973 | 1973 | for ($number = 0; $number <= 25; $number++) { |
1974 | - $plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number); |
|
1974 | + $plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float) $number), (float) $number); |
|
1975 | 1975 | } |
1976 | 1976 | return $plurals; |
1977 | 1977 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param Model $model Model using this behavior |
107 | 107 | * @param array $options Options passed from Model::save(). |
108 | - * @return mixed False if the operation should abort. Any other result will continue. |
|
108 | + * @return boolean|null False if the operation should abort. Any other result will continue. |
|
109 | 109 | * @see Model::save() |
110 | 110 | */ |
111 | 111 | public function beforeSave(Model $model, $options = array()) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param Model $model |
131 | 131 | * @param boolean $created |
132 | 132 | * @param array $options Options passed from Model::save(). |
133 | - * @return void |
|
133 | + * @return boolean|null |
|
134 | 134 | */ |
135 | 135 | public function afterSave(Model $model, $created, $options = array()) { |
136 | 136 | $settings = $this->settings[$model->alias]; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * beforeValidate Callback |
161 | 161 | * |
162 | - * @param Model $Model Model invalidFields was called on. |
|
162 | + * @param Model $model Model invalidFields was called on. |
|
163 | 163 | * @param array $options Options passed from Model::save(). |
164 | - * @return boolean |
|
164 | + * @return boolean|null |
|
165 | 165 | * @see Model::save() |
166 | 166 | */ |
167 | 167 | public function beforeValidate(Model $model, $options = array()) { |
@@ -188,8 +188,7 @@ discard block |
||
188 | 188 | * afterValidate method |
189 | 189 | * |
190 | 190 | * @param Model $model |
191 | - * @param boolean $cascade |
|
192 | - * @return void |
|
191 | + * @return boolean|null |
|
193 | 192 | */ |
194 | 193 | public function afterValidate(Model $model) { |
195 | 194 | $settings = $this->settings[$model->alias]; |
@@ -210,7 +209,7 @@ discard block |
||
210 | 209 | * |
211 | 210 | * @param Model $model |
212 | 211 | * @param boolean $cascade |
213 | - * @return void |
|
212 | + * @return boolean|null |
|
214 | 213 | */ |
215 | 214 | public function beforeDelete(Model $model, $cascade = true) { |
216 | 215 | $settings = $this->settings[$model->alias]; |
@@ -267,7 +266,7 @@ discard block |
||
267 | 266 | * beforeTest method |
268 | 267 | * |
269 | 268 | * @param Model $model |
270 | - * @return void |
|
269 | + * @return string |
|
271 | 270 | */ |
272 | 271 | public function beforeTest(Model $model) { |
273 | 272 | if (!isset($model->beforeTestResult)) { |
@@ -282,7 +281,7 @@ discard block |
||
282 | 281 | * |
283 | 282 | * @param Model $model |
284 | 283 | * @param boolean $param |
285 | - * @return void |
|
284 | + * @return string|null |
|
286 | 285 | */ |
287 | 286 | public function testMethod(Model $model, $param = true) { |
288 | 287 | if ($param === true) { |
@@ -294,7 +293,7 @@ discard block |
||
294 | 293 | * testData method |
295 | 294 | * |
296 | 295 | * @param Model $model |
297 | - * @return void |
|
296 | + * @return boolean |
|
298 | 297 | */ |
299 | 298 | public function testData(Model $model) { |
300 | 299 | if (!isset($model->data['Apple']['field'])) { |
@@ -309,7 +308,7 @@ discard block |
||
309 | 308 | * |
310 | 309 | * @param Model $model |
311 | 310 | * @param string|array $field |
312 | - * @return void |
|
311 | + * @return boolean |
|
313 | 312 | */ |
314 | 313 | public function validateField(Model $model, $field) { |
315 | 314 | return current($field) === 'Orange'; |
@@ -321,7 +320,7 @@ discard block |
||
321 | 320 | * @param Model $model |
322 | 321 | * @param string $method |
323 | 322 | * @param string $query |
324 | - * @return void |
|
323 | + * @return string |
|
325 | 324 | */ |
326 | 325 | public function speakEnglish(Model $model, $method, $query) { |
327 | 326 | $method = preg_replace('/look for\s+/', 'Item.name = \'', $method); |
@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * BehaviorTest file |
|
4 | - * |
|
5 | - * Long description for behavior.test.php |
|
6 | - * |
|
7 | - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
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://cakephp.org CakePHP(tm) Project |
|
16 | - * @package Cake.Test.Case.Model |
|
17 | - * @since 1.2 |
|
18 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
19 | - */ |
|
3 | + * BehaviorTest file |
|
4 | + * |
|
5 | + * Long description for behavior.test.php |
|
6 | + * |
|
7 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
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://cakephp.org CakePHP(tm) Project |
|
16 | + * @package Cake.Test.Case.Model |
|
17 | + * @since 1.2 |
|
18 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
19 | + */ |
|
20 | 20 | |
21 | 21 | App::uses('AppModel', 'Model'); |
22 | 22 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | App::uses('AppModel', 'Model'); |
22 | 22 | |
23 | -require_once dirname(__FILE__) . DS . 'models.php'; |
|
23 | +require_once dirname(__FILE__).DS.'models.php'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * TestBehavior class |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function beforeFind(Model $model, $query) { |
62 | 62 | $settings = $this->settings[$model->alias]; |
63 | - if (!isset($settings['beforeFind']) || $settings['beforeFind'] === 'off') { |
|
63 | + if ( ! isset($settings['beforeFind']) || $settings['beforeFind'] === 'off') { |
|
64 | 64 | return parent::beforeFind($model, $query); |
65 | 65 | } |
66 | 66 | switch ($settings['beforeFind']) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | case 'test': |
70 | 70 | return null; |
71 | 71 | case 'modify': |
72 | - $query['fields'] = array($model->alias . '.id', $model->alias . '.name', $model->alias . '.mytime'); |
|
72 | + $query['fields'] = array($model->alias.'.id', $model->alias.'.name', $model->alias.'.mytime'); |
|
73 | 73 | $query['recursive'] = -1; |
74 | 74 | return $query; |
75 | 75 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function afterFind(Model $model, $results, $primary = false) { |
87 | 87 | $settings = $this->settings[$model->alias]; |
88 | - if (!isset($settings['afterFind']) || $settings['afterFind'] === 'off') { |
|
88 | + if ( ! isset($settings['afterFind']) || $settings['afterFind'] === 'off') { |
|
89 | 89 | return parent::afterFind($model, $results, $primary); |
90 | 90 | } |
91 | 91 | switch ($settings['afterFind']) { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function beforeSave(Model $model, $options = array()) { |
112 | 112 | $settings = $this->settings[$model->alias]; |
113 | - if (!isset($settings['beforeSave']) || $settings['beforeSave'] === 'off') { |
|
113 | + if ( ! isset($settings['beforeSave']) || $settings['beforeSave'] === 'off') { |
|
114 | 114 | return parent::beforeSave($model, $options); |
115 | 115 | } |
116 | 116 | switch ($settings['beforeSave']) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function afterSave(Model $model, $created, $options = array()) { |
136 | 136 | $settings = $this->settings[$model->alias]; |
137 | - if (!isset($settings['afterSave']) || $settings['afterSave'] === 'off') { |
|
137 | + if ( ! isset($settings['afterSave']) || $settings['afterSave'] === 'off') { |
|
138 | 138 | return parent::afterSave($model, $created, $options); |
139 | 139 | } |
140 | 140 | $string = 'modified after'; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | case 'test2': |
152 | 152 | return false; |
153 | 153 | case 'modify': |
154 | - $model->data[$model->alias]['name'] .= ' ' . $string; |
|
154 | + $model->data[$model->alias]['name'] .= ' '.$string; |
|
155 | 155 | break; |
156 | 156 | } |
157 | 157 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function beforeValidate(Model $model, $options = array()) { |
168 | 168 | $settings = $this->settings[$model->alias]; |
169 | - if (!isset($settings['validate']) || $settings['validate'] === 'off') { |
|
169 | + if ( ! isset($settings['validate']) || $settings['validate'] === 'off') { |
|
170 | 170 | return parent::beforeValidate($model, $options); |
171 | 171 | } |
172 | 172 | switch ($settings['validate']) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function afterValidate(Model $model) { |
195 | 195 | $settings = $this->settings[$model->alias]; |
196 | - if (!isset($settings['afterValidate']) || $settings['afterValidate'] === 'off') { |
|
196 | + if ( ! isset($settings['afterValidate']) || $settings['afterValidate'] === 'off') { |
|
197 | 197 | return parent::afterValidate($model); |
198 | 198 | } |
199 | 199 | switch ($settings['afterValidate']) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function beforeDelete(Model $model, $cascade = true) { |
216 | 216 | $settings = $this->settings[$model->alias]; |
217 | - if (!isset($settings['beforeDelete']) || $settings['beforeDelete'] === 'off') { |
|
217 | + if ( ! isset($settings['beforeDelete']) || $settings['beforeDelete'] === 'off') { |
|
218 | 218 | return parent::beforeDelete($model, $cascade); |
219 | 219 | } |
220 | 220 | switch ($settings['beforeDelete']) { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function afterDelete(Model $model) { |
241 | 241 | $settings = $this->settings[$model->alias]; |
242 | - if (!isset($settings['afterDelete']) || $settings['afterDelete'] === 'off') { |
|
242 | + if ( ! isset($settings['afterDelete']) || $settings['afterDelete'] === 'off') { |
|
243 | 243 | return parent::afterDelete($model); |
244 | 244 | } |
245 | 245 | switch ($settings['afterDelete']) { |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function onError(Model $model, $error) { |
259 | 259 | $settings = $this->settings[$model->alias]; |
260 | - if (!isset($settings['onError']) || $settings['onError'] === 'off') { |
|
260 | + if ( ! isset($settings['onError']) || $settings['onError'] === 'off') { |
|
261 | 261 | return parent::onError($model, $error); |
262 | 262 | } |
263 | 263 | echo "onError trigger success"; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @return void |
271 | 271 | */ |
272 | 272 | public function beforeTest(Model $model) { |
273 | - if (!isset($model->beforeTestResult)) { |
|
273 | + if ( ! isset($model->beforeTestResult)) { |
|
274 | 274 | $model->beforeTestResult = array(); |
275 | 275 | } |
276 | 276 | $model->beforeTestResult[] = strtolower(get_class($this)); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return void |
298 | 298 | */ |
299 | 299 | public function testData(Model $model) { |
300 | - if (!isset($model->data['Apple']['field'])) { |
|
300 | + if ( ! isset($model->data['Apple']['field'])) { |
|
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | $model->data['Apple']['field_2'] = true; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | public function speakEnglish(Model $model, $method, $query) { |
327 | 327 | $method = preg_replace('/look for\s+/', 'Item.name = \'', $method); |
328 | 328 | $query = preg_replace('/^in\s+/', 'Location.name = \'', $query); |
329 | - return $method . '\' AND ' . $query . '\''; |
|
329 | + return $method.'\' AND '.$query.'\''; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $this->assertEquals('working', $Apple->testMethod(true)); |
506 | 506 | $this->assertEquals('working', $Apple->Behaviors->dispatchMethod($Apple, 'testMethod')); |
507 | 507 | |
508 | - App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS))); |
|
508 | + App::build(array('Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS))); |
|
509 | 509 | CakePlugin::load('TestPlugin'); |
510 | 510 | $this->assertTrue($Apple->Behaviors->load('SomeOther', array('className' => 'TestPlugin.TestPluginPersisterOne'))); |
511 | 511 | $this->assertInstanceOf('TestPluginPersisterOneBehavior', $Apple->Behaviors->SomeOther); |