Skip to content

Commit

Permalink
Merge pull request #4940 from morozov/oracle-test-connection-leaks
Browse files Browse the repository at this point in the history
Fix connection leaks in Oracle functional tests
  • Loading branch information
derrabus committed Oct 31, 2021
2 parents 757ce1f + 81c54e8 commit ea1d9d1
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions tests/Functional/Schema/OracleSchemaManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ protected function supportsPlatform(AbstractPlatform $platform): bool
return $platform instanceof OraclePlatform;
}

protected function setUp(): void
{
parent::setUp();

if (! isset($GLOBALS['db_user'])) {
self::markTestSkipped('Username must be explicitly specified in connection parameters for this test');
}

TestUtil::getPrivilegedConnection()
->executeStatement('GRANT ALL PRIVILEGES TO ' . $GLOBALS['db_user']);
}

public function testRenameTable(): void
{
$this->schemaManager->tryMethod('DropTable', 'list_tables_test');
Expand Down Expand Up @@ -92,9 +80,11 @@ public function testAlterTableColumnNotNull(): void
public function testListDatabases(): void
{
// We need a privileged connection to create the database.
$sm = TestUtil::getPrivilegedConnection()->getSchemaManager();
$connection = TestUtil::getPrivilegedConnection();
$sm = $connection->getSchemaManager();

$sm->dropAndCreateDatabase('c##test_create_database');
$connection->close();

$databases = $this->schemaManager->listDatabases();
$databases = array_map('strtolower', $databases);
Expand Down Expand Up @@ -225,7 +215,11 @@ public function testListTableColumnsSameTableNamesInDifferentSchemas(): void

$otherTable = new Table($table->getName());
$otherTable->addColumn('id', Types::STRING);
TestUtil::getPrivilegedConnection()->getSchemaManager()->dropAndCreateTable($otherTable);

$connection = TestUtil::getPrivilegedConnection();
$sm = $connection->getSchemaManager();
$sm->dropAndCreateTable($otherTable);
$connection->close();

$columns = $this->schemaManager->listTableColumns($table->getName(), $this->connection->getDatabase());
self::assertCount(7, $columns);
Expand Down

0 comments on commit ea1d9d1

Please sign in to comment.