Skip to content

Commit

Permalink
Merge pull request #4991 from morozov/optimize-sharing-test-connection
Browse files Browse the repository at this point in the history
Optimize sharing test connection
  • Loading branch information
derrabus committed Nov 15, 2021
2 parents 10df50f + 8fb8105 commit fa27901
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
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

0 comments on commit fa27901

Please sign in to comment.