Browse Source

Use PHP5.4 arrays

Mark Scherer 10 years ago
parent
commit
882fcbcb91

+ 1 - 1
Model/MyModel.php

@@ -1239,7 +1239,7 @@ class MyModel extends ShimModel {
 			return $this->get($id, $options);
 		} catch (RecordNotFoundException $e) {
 		}
-		return array();
+		return [];
 	}
 
 	/**

+ 1 - 1
Test/Case/Controller/QloginControllerTest.php

@@ -3,7 +3,7 @@
 App::uses('QloginController', 'Tools.Controller');
 App::uses('ComponentCollection', 'Controller');
 
-Configure::write('Routing.prefixes', array('admin'));
+Configure::write('Routing.prefixes', ['admin']);
 
 class QloginControllerTest extends ControllerTestCase {
 

+ 13 - 13
Test/Case/TestSuite/IntegrationTestCaseTest.php

@@ -6,11 +6,11 @@ class IntegrationTestCaseTest extends IntegrationTestCase {
 	public function setUp() {
 		parent::setUp();
 
-		App::build(array(
-			'Controller' => array(CakePlugin::path('Shim') . 'Test' . DS . 'test_app' . DS . 'Controller' . DS),
-			'Model' => array(CakePlugin::path('Shim') . 'Test' . DS . 'test_app' . DS . 'Model' . DS),
-			'View' => array(CakePlugin::path('Shim') . 'Test' . DS . 'test_app' . DS . 'View' . DS)
-		), App::RESET);
+		App::build([
+			'Controller' => [CakePlugin::path('Shim') . 'Test' . DS . 'test_app' . DS . 'Controller' . DS],
+			'Model' => [CakePlugin::path('Shim') . 'Test' . DS . 'test_app' . DS . 'Model' . DS],
+			'View' => [CakePlugin::path('Shim') . 'Test' . DS . 'test_app' . DS . 'View' . DS]
+		], App::RESET);
 	}
 
 	/**
@@ -19,7 +19,7 @@ class IntegrationTestCaseTest extends IntegrationTestCase {
 	 * @return void
 	 */
 	public function testBasic() {
-		$this->get(array('controller' => 'items', 'action' => 'index'));
+		$this->get(['controller' => 'items', 'action' => 'index']);
 		$this->assertResponseCode(200);
 		$this->assertNoRedirect();
 		$this->assertResponseNotEmpty();
@@ -32,10 +32,10 @@ class IntegrationTestCaseTest extends IntegrationTestCase {
 	 * @return void
 	 */
 	public function testPosting() {
-		$data = array(
+		$data = [
 			'key' => 'sth'
-		);
-		$this->post(array('controller' => 'items', 'action' => 'posting'), $data);
+		];
+		$this->post(['controller' => 'items', 'action' => 'posting'], $data);
 		$this->assertResponseCode(200);
 		$this->assertNoRedirect();
 	}
@@ -46,9 +46,9 @@ class IntegrationTestCaseTest extends IntegrationTestCase {
 	 * @return void
 	 */
 	public function testSession() {
-		$this->session(array('Auth.User.id' => 1));
+		$this->session(['Auth.User.id' => 1]);
 
-		$this->get(array('controller' => 'items', 'action' => 'session'));
+		$this->get(['controller' => 'items', 'action' => 'session']);
 		$this->assertResponseCode(200);
 		$this->assertNoRedirect();
 
@@ -61,7 +61,7 @@ class IntegrationTestCaseTest extends IntegrationTestCase {
 	 * @return void
 	 */
 	public function testRedirecting() {
-		$this->get(array('controller' => 'items', 'action' => 'redirecting'));
+		$this->get(['controller' => 'items', 'action' => 'redirecting']);
 		$this->assertResponseCode(302);
 		$this->assertRedirect('/foobar');
 
@@ -79,7 +79,7 @@ class IntegrationTestCaseTest extends IntegrationTestCase {
 	 * @return void
 	 */
 	public function testExceptional() {
-		$this->get(array('controller' => 'items', 'action' => 'exceptional'));
+		$this->get(['controller' => 'items', 'action' => 'exceptional']);
 	}
 
 }