diff --git a/docs/en/reference/testing.rst b/docs/en/reference/testing.rst index 87f6956700b..74fbcf28c2c 100644 --- a/docs/en/reference/testing.rst +++ b/docs/en/reference/testing.rst @@ -79,7 +79,7 @@ then run the following command: .. code-block:: console - $ phpunit -c ci/github/pdo_mysql.xml + $ phpunit -c ci/github/phpunit/pdo_mysql.xml We do not currently have specific instructions on how to run a Database server, but we do recommend Docker as a convenient way to do so. diff --git a/src/Schema/AbstractSchemaManager.php b/src/Schema/AbstractSchemaManager.php index 2e38bb88ce4..9705e6f788d 100644 --- a/src/Schema/AbstractSchemaManager.php +++ b/src/Schema/AbstractSchemaManager.php @@ -249,11 +249,12 @@ protected function doListTableColumns($table, $database = null): array ); } + $normalizedTable = $this->normalizeName($table); + return $this->_getPortableTableColumnList( - $table, + $normalizedTable, $database, - $this->selectTableColumns($database, $this->normalizeName($table)) - ->fetchAllAssociative(), + $this->selectTableColumns($database, $normalizedTable)->fetchAllAssociative(), ); } @@ -486,7 +487,7 @@ protected function doListTableDetails($name): Table $this->listTableIndexes($name), [], $foreignKeys, - $tableOptionsByTable[$normalizedName] ?? [], + $tableOptionsByTable[$name] ?? [], ); } diff --git a/src/Schema/OracleSchemaManager.php b/src/Schema/OracleSchemaManager.php index 3608e05660b..a099145d656 100644 --- a/src/Schema/OracleSchemaManager.php +++ b/src/Schema/OracleSchemaManager.php @@ -512,13 +512,13 @@ protected function fetchTableOptionsByTable(string $databaseName, ?string $table $sql .= ' FROM ALL_TAB_COMMENTS WHERE ' . implode(' AND ', $conditions); - /** @var array> $metadata */ - $metadata = $this->_conn->executeQuery($sql, $params) - ->fetchAllAssociativeIndexed(); + /** @var array $metadata */ + $metadata = $this->_conn->executeQuery($sql, $params)->fetchAllAssociative(); $tableOptions = []; - foreach ($metadata as $table => $data) { - $data = array_change_key_case($data, CASE_LOWER); + foreach ($metadata as $data) { + $data = array_change_key_case($data, CASE_LOWER); + $table = $this->_getPortableTableDefinition($data); $tableOptions[$table] = [ 'comment' => $data['comments'], diff --git a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php index 1eebf4be95a..86aa6df7d96 100644 --- a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -1676,10 +1676,12 @@ public function testIntrospectReservedKeywordTableViaListTableDetails(): void { $this->createReservedKeywordTables(); - $user = $this->schemaManager->introspectTable('"user"'); - self::assertCount(2, $user->getColumns()); - self::assertCount(2, $user->getIndexes()); - self::assertCount(1, $user->getForeignKeys()); + $select = $this->schemaManager->introspectTable('"select"'); + self::assertCount(3, $select->getColumns()); + self::assertCount(2, $select->getIndexes()); + self::assertCount(1, $select->getForeignKeys()); + self::assertSame('table comment', $select->getComment()); + self::assertSame('column comment', $select->getColumn('select')->getComment()); } public function testIntrospectReservedKeywordTableViaListTables(): void @@ -1688,24 +1690,28 @@ public function testIntrospectReservedKeywordTableViaListTables(): void $tables = $this->schemaManager->listTables(); - $user = $this->findTableByName($tables, 'user'); - self::assertNotNull($user); - self::assertCount(2, $user->getColumns()); - self::assertCount(2, $user->getIndexes()); - self::assertCount(1, $user->getForeignKeys()); + $select = $this->findTableByName($tables, 'select'); + self::assertNotNull($select); + self::assertCount(3, $select->getColumns()); + self::assertCount(2, $select->getIndexes()); + self::assertCount(1, $select->getForeignKeys()); + self::assertSame('table comment', $select->getComment()); + self::assertSame('column comment', $select->getColumn('select')->getComment()); } private function createReservedKeywordTables(): void { $platform = $this->connection->getDatabasePlatform(); - $this->dropTableIfExists($platform->quoteIdentifier('user')); + $this->dropTableIfExists($platform->quoteIdentifier('select')); $this->dropTableIfExists($platform->quoteIdentifier('group')); $schema = new Schema(); - $user = $schema->createTable('user'); + $user = $schema->createTable('select'); + $user->setComment('table comment'); $user->addColumn('id', Types::INTEGER); + $user->addColumn('select', Types::INTEGER)->setComment('column comment'); $user->addColumn('group_id', Types::INTEGER); $user->setPrimaryKey(['id']); $user->addForeignKeyConstraint('group', ['group_id'], ['id']);