Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize sharing test connection #4991

Merged
merged 2 commits into from Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/Functional/PortabilityTest.php
Expand Up @@ -49,7 +49,9 @@ protected function setUp(): void

protected function tearDown(): void
{
$this->markConnectionNotReusable();
// the connection that overrides the shared one has to be manually closed prior to 4.0.0 to prevent leak
// see https://github.com/doctrine/dbal/issues/4515
$this->connection->close();
}

public function testFullFetchMode(): void
Expand Down
8 changes: 3 additions & 5 deletions tests/Functional/Schema/MySQLSchemaManagerTest.php
Expand Up @@ -21,11 +21,6 @@ public static function setUpBeforeClass(): void
Type::addType('point', PointType::class);
}

protected function tearDown(): void
{
$this->markConnectionNotReusable();
}

protected function supportsPlatform(AbstractPlatform $platform): bool
{
return $platform instanceof MySQLPlatform;
Expand Down Expand Up @@ -106,6 +101,9 @@ public function testSpatialIndex(): void

$this->schemaManager->dropAndCreateTable($table);

// see https://github.com/doctrine/dbal/issues/4983
$this->markConnectionNotReusable();

$indexes = $this->schemaManager->listTableIndexes('spatial_index');
self::assertArrayHasKey('s_index', $indexes);
self::assertTrue($indexes['s_index']->hasFlag('spatial'));
Expand Down
2 changes: 2 additions & 0 deletions tests/Functional/Schema/PostgreSQLSchemaManagerTest.php
Expand Up @@ -198,6 +198,8 @@ public function testFilterSchemaExpression(): void
$testTable->addColumn('id', 'integer');
$this->schemaManager->createTable($testTable);

$this->markConnectionNotReusable();

$this->connection->getConfiguration()->setSchemaAssetsFilter(static function (string $name): bool {
return preg_match('#^dbal204_#', $name) === 1;
});
Expand Down
2 changes: 0 additions & 2 deletions tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
Expand Up @@ -78,8 +78,6 @@ protected function tearDown(): void
$this->connection->executeStatement('DROP SCHEMA testschema');
} catch (Exception $e) {
}

$this->markConnectionNotReusable();
}

public function testDropAndCreateSequence(): void
Expand Down