diff --git a/lib/Doctrine/Migrations/Configuration/Loader/ArrayLoader.php b/lib/Doctrine/Migrations/Configuration/Loader/ArrayLoader.php index df31d63071..c7970fcec6 100644 --- a/lib/Doctrine/Migrations/Configuration/Loader/ArrayLoader.php +++ b/lib/Doctrine/Migrations/Configuration/Loader/ArrayLoader.php @@ -65,6 +65,10 @@ public function load($array) : Configuration $object = new Configuration(); self::applyConfigs($configMap, $object, $array); + if ($object->getMetadataStorageConfiguration() === null) { + $object->setMetadataStorageConfiguration(new TableMetadataStorageConfiguration()); + } + return $object; } diff --git a/tests/Doctrine/Migrations/Tests/Configuration/Loader/AbstractLoaderTest.php b/tests/Doctrine/Migrations/Tests/Configuration/Loader/AbstractLoaderTest.php index 11111018bc..65ce44184b 100644 --- a/tests/Doctrine/Migrations/Tests/Configuration/Loader/AbstractLoaderTest.php +++ b/tests/Doctrine/Migrations/Tests/Configuration/Loader/AbstractLoaderTest.php @@ -36,6 +36,25 @@ public function testLoad() : void self::assertSame('doctrine_migration_executed_at_column_test', $storage->getExecutedAtColumnName()); } + public function testLoadBasic() : void + { + $config = $this->load('basic'); + + self::assertNull($config->getName()); + self::assertSame(['DoctrineMigrationsTest' => dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files'], $config->getMigrationDirectories()); + + self::assertSame([], $config->getMigrationClasses()); + + $storage = $config->getMetadataStorageConfiguration(); + self::assertInstanceOf(TableMetadataStorageConfiguration::class, $storage); + + self::assertSame('doctrine_migration_versions', $storage->getTableName()); + self::assertSame('version', $storage->getVersionColumnName()); + self::assertSame(1024, $storage->getVersionColumnLength()); + self::assertSame('execution_time', $storage->getExecutionTimeColumnName()); + self::assertSame('executed_at', $storage->getExecutedAtColumnName()); + } + public function testConfigurationFileNotExists() : void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.json b/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.json new file mode 100644 index 0000000000..d5861dd17e --- /dev/null +++ b/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.json @@ -0,0 +1,5 @@ +{ + "migrations_paths" : { + "DoctrineMigrationsTest": "." + } +} diff --git a/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.php b/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.php new file mode 100644 index 0000000000..ca06bba022 --- /dev/null +++ b/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.php @@ -0,0 +1,7 @@ + ['DoctrineMigrationsTest' => '.'], +]; diff --git a/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.xml b/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.xml new file mode 100644 index 0000000000..e0f8686a90 --- /dev/null +++ b/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.xml @@ -0,0 +1,12 @@ + + + + . + + + + + diff --git a/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.yml b/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.yml new file mode 100644 index 0000000000..5bb942027e --- /dev/null +++ b/tests/Doctrine/Migrations/Tests/Configuration/_files/config_basic.yml @@ -0,0 +1,5 @@ +--- +migrations_paths: + DoctrineMigrationsTest: . + +