Fixed test failures on PHP 7.4

The failures are caused by the changes in PHP according to https://wiki.php.net/rfc/notice-for-non-valid-array-container.
parent bf9d55cd
...@@ -309,13 +309,20 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -309,13 +309,20 @@ class MySqlSchemaManager extends AbstractSchemaManager
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
if ($tableOptions === false) {
return $table;
}
$table->addOption('engine', $tableOptions['ENGINE']); $table->addOption('engine', $tableOptions['ENGINE']);
if ($tableOptions['TABLE_COLLATION'] !== null) { if ($tableOptions['TABLE_COLLATION'] !== null) {
$table->addOption('collation', $tableOptions['TABLE_COLLATION']); $table->addOption('collation', $tableOptions['TABLE_COLLATION']);
} }
if ($tableOptions['AUTO_INCREMENT'] !== null) { if ($tableOptions['AUTO_INCREMENT'] !== null) {
$table->addOption('autoincrement', $tableOptions['AUTO_INCREMENT']); $table->addOption('autoincrement', $tableOptions['AUTO_INCREMENT']);
} }
$table->addOption('comment', $tableOptions['TABLE_COMMENT']); $table->addOption('comment', $tableOptions['TABLE_COMMENT']);
$table->addOption('create_options', $this->parseCreateOptions($tableOptions['CREATE_OPTIONS'])); $table->addOption('create_options', $this->parseCreateOptions($tableOptions['CREATE_OPTIONS']));
......
...@@ -34,7 +34,9 @@ class Table extends AbstractAsset ...@@ -34,7 +34,9 @@ class Table extends AbstractAsset
protected $_fkConstraints = []; protected $_fkConstraints = [];
/** @var mixed[] */ /** @var mixed[] */
protected $_options = []; protected $_options = [
'create_options' => [],
];
/** @var SchemaConfig|null */ /** @var SchemaConfig|null */
protected $_schemaConfig = null; protected $_schemaConfig = null;
...@@ -69,7 +71,7 @@ class Table extends AbstractAsset ...@@ -69,7 +71,7 @@ class Table extends AbstractAsset
$this->_addForeignKeyConstraint($constraint); $this->_addForeignKeyConstraint($constraint);
} }
$this->_options = $options; $this->_options = array_merge($this->_options, $options);
} }
/** /**
......
...@@ -59,6 +59,11 @@ class OCI8StatementTest extends DbalTestCase ...@@ -59,6 +59,11 @@ class OCI8StatementTest extends DbalTestCase
$this->equalTo($params[2]) $this->equalTo($params[2])
); );
// the return value is irrelevant to the test
// but it has to be compatible with the method signature
$statement->method('errorInfo')
->willReturn(false);
// can't pass to constructor since we don't have a real database handle, // can't pass to constructor since we don't have a real database handle,
// but execute must check the connection for the executeMode // but execute must check the connection for the executeMode
$conn = $this->getMockBuilder(OCI8Connection::class) $conn = $this->getMockBuilder(OCI8Connection::class)
......
...@@ -47,6 +47,10 @@ class PoolingShardManagerTest extends TestCase ...@@ -47,6 +47,10 @@ class PoolingShardManagerTest extends TestCase
{ {
$conn = $this->createConnectionMock(); $conn = $this->createConnectionMock();
$conn->expects($this->once())->method('connect')->with($this->equalTo(0)); $conn->expects($this->once())->method('connect')->with($this->equalTo(0));
$conn->method('getParams')
->willReturn([
'shardChoser' => $this->createMock(ShardChoser::class),
]);
$shardManager = new PoolingShardManager($conn); $shardManager = new PoolingShardManager($conn);
$shardManager->selectGlobal(); $shardManager->selectGlobal();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment