Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 633a60e

Browse filesBrowse files
committed
drop existing schema if tests create it explicitly
The former test implementation relied on the order in which tests are executed assuming that tests explicitly creating the schema were executed first. This assumption leads to test failures on PHPUnit 10+ were tests defined in parent classes are run first where they were run later with PHPUnit 9.6.
1 parent c3b0509 commit 633a60e
Copy full SHA for 633a60e

File tree

Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed

‎src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public function createCachePool(int $defaultLifetime = 0): CacheItemPoolInterfac
4848

4949
public function testConfigureSchemaDecoratedDbalDriver()
5050
{
51+
if (file_exists(self::$dbFile)) {
52+
@unlink(self::$dbFile);
53+
}
54+
5155
$connection = DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile], $this->getDbalConfig());
5256
if (!interface_exists(Middleware::class)) {
5357
$this->markTestSkipped('doctrine/dbal v2 does not support custom drivers using middleware');
@@ -73,6 +77,10 @@ public function testConfigureSchemaDecoratedDbalDriver()
7377

7478
public function testConfigureSchema()
7579
{
80+
if (file_exists(self::$dbFile)) {
81+
@unlink(self::$dbFile);
82+
}
83+
7684
$connection = DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile], $this->getDbalConfig());
7785
$schema = new Schema();
7886

@@ -83,6 +91,10 @@ public function testConfigureSchema()
8391

8492
public function testConfigureSchemaDifferentDbalConnection()
8593
{
94+
if (file_exists(self::$dbFile)) {
95+
@unlink(self::$dbFile);
96+
}
97+
8698
$otherConnection = $this->createConnectionMock();
8799
$schema = new Schema();
88100

@@ -93,6 +105,10 @@ public function testConfigureSchemaDifferentDbalConnection()
93105

94106
public function testConfigureSchemaTableExists()
95107
{
108+
if (file_exists(self::$dbFile)) {
109+
@unlink(self::$dbFile);
110+
}
111+
96112
$connection = DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile], $this->getDbalConfig());
97113
$schema = new Schema();
98114
$schema->createTable('cache_items');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.