diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 09:30:18 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 16:34:56 +0100 |
commit | b80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch) | |
tree | ec20e0ffa2f86b9b54939a83a785407319f94559 /tests/lib/DB/MigratorTest.php | |
parent | 62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff) | |
download | nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.tar.gz nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.zip |
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/DB/MigratorTest.php')
-rw-r--r-- | tests/lib/DB/MigratorTest.php | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index e5cc28654e4..a438d0189df 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -77,19 +77,19 @@ class MigratorTest extends \Test\TestCase { * @return \Doctrine\DBAL\Schema\Schema[] */ private function getDuplicateKeySchemas() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $table->addIndex(array('id'), $this->tableName . '_id'); + $table->addIndex(['id'], $this->tableName . '_id'); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $table->addUniqueIndex(array('id'), $this->tableName . '_id'); + $table->addUniqueIndex(['id'], $this->tableName . '_id'); - return array($startSchema, $endSchema); + return [$startSchema, $endSchema]; } private function getSchemaConfig() { @@ -113,9 +113,9 @@ class MigratorTest extends \Test\TestCase { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $this->fail('checkMigrate should have failed'); @@ -126,9 +126,9 @@ class MigratorTest extends \Test\TestCase { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 3, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 3, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); @@ -145,9 +145,9 @@ class MigratorTest extends \Test\TestCase { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 3, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 3, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); @@ -163,10 +163,10 @@ class MigratorTest extends \Test\TestCase { $migrator->migrate($endSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); try { - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'qwerty']); $this->fail('Expected duplicate key insert to fail'); } catch (DBALException $e) { $this->addToAssertionCount(1); @@ -174,16 +174,16 @@ class MigratorTest extends \Test\TestCase { } public function testAddingPrimaryKeyWithAutoIncrement() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); + $table->addColumn('id', 'integer', ['autoincrement' => true]); $table->addColumn('name', 'string'); - $table->setPrimaryKey(array('id')); + $table->setPrimaryKey(['id']); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); @@ -195,17 +195,17 @@ class MigratorTest extends \Test\TestCase { } public function testReservedKeywords() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); - $table->addColumn('user', 'string', array('length' => 255)); - $table->setPrimaryKey(array('id')); + $table->addColumn('id', 'integer', ['autoincrement' => true]); + $table->addColumn('user', 'string', ['length' => 255]); + $table->setPrimaryKey(['id']); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); - $table->addColumn('user', 'string', array('length' => 64)); - $table->setPrimaryKey(array('id')); + $table->addColumn('id', 'integer', ['autoincrement' => true]); + $table->addColumn('user', 'string', ['length' => 64]); + $table->setPrimaryKey(['id']); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); @@ -227,7 +227,7 @@ class MigratorTest extends \Test\TestCase { $tableFk = $startSchema->createTable($this->tableNameTmp); $tableFk->addColumn('fk_id', 'integer'); $tableFk->addColumn('name', 'string'); - $tableFk->addForeignKeyConstraint($this->tableName, array('fk_id'), array('id'), array(), $fkName); + $tableFk->addForeignKeyConstraint($this->tableName, ['fk_id'], ['id'], [], $fkName); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); |