Fix some count() Error in PHP 7.2

This commit is contained in:
Koji Tanaka 2018-01-17 03:35:00 +09:00
parent f4315d8ba4
commit aa14c68497
3 changed files with 11 additions and 7 deletions

View file

@ -328,7 +328,7 @@ class ControllerTask extends BakeTask {
* @param array $components Components to use in controller
* @return string Baked controller
*/
public function bake($controllerName, $actions = '', $helpers = null, $components = null) {
public function bake($controllerName, $actions = '', $helpers = array(), $components = array()) {
$this->out("\n" . __d('cake_console', 'Baking controller class for %s...', $controllerName), 1, Shell::QUIET);
$isScaffold = ($actions === 'scaffold') ? true : false;

View file

@ -64,7 +64,7 @@ class ConnectionManagerTest extends CakeTestCase {
ConnectionManager::create($name, $config);
$connections = ConnectionManager::enumConnectionObjects();
$this->assertTrue((bool)(count(array_keys($connections) >= 1)));
$this->assertTrue(count(array_keys($connections)) >= 1);
$source = ConnectionManager::getDataSource('test_get_datasource');
$this->assertTrue(is_object($source));
@ -239,7 +239,7 @@ class ConnectionManagerTest extends CakeTestCase {
$name = 'test_created_connection';
$connections = ConnectionManager::enumConnectionObjects();
$this->assertTrue((bool)(count(array_keys($connections) >= 1)));
$this->assertTrue(count(array_keys($connections)) >= 1);
$source = ConnectionManager::getDataSource('test');
$this->assertTrue(is_object($source));

View file

@ -3367,7 +3367,9 @@ class ModelWriteTest extends BaseModelTest {
array(
'comment' => 'Article comment',
'user_id' => 1
)));
)
)
);
$Article = new Article();
$result = $Article->saveAll($data);
$this->assertFalse(empty($result));
@ -3376,7 +3378,7 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals(2, count($result['Tag']));
$this->assertEquals('tag1', $result['Tag'][0]['tag']);
$this->assertEquals(1, count($result['Comment']));
$this->assertEquals(1, count($result['Comment'][0]['comment']));
$this->assertEquals('Article comment', $result['Comment'][0]['comment']);
}
/**
@ -5647,7 +5649,9 @@ class ModelWriteTest extends BaseModelTest {
array(
'comment' => 'Article comment',
'user_id' => 1
)));
)
)
);
$Article = new Article();
$result = $Article->saveAssociated($data);
$this->assertFalse(empty($result));
@ -5656,7 +5660,7 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals(2, count($result['Tag']));
$this->assertEquals('tag1', $result['Tag'][0]['tag']);
$this->assertEquals(1, count($result['Comment']));
$this->assertEquals(1, count($result['Comment'][0]['comment']));
$this->assertEquals('Article comment', $result['Comment'][0]['comment']);
}
/**