10000 minor #36927 [Cache][Lock][Messenger] Don't execute tests with DBAL 2… · symfony/symfony@098d84a · GitHub
[go: up one dir, main page]

Skip to content

Commit 098d84a

Browse files
minor #36927 [Cache][Lock][Messenger] Don't execute tests with DBAL 2.x on php 8 (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- [Cache][Lock][Messenger] Don't execute tests with DBAL 2.x on php 8 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #36872 | License | MIT | Doc PR | N/A Follow-up to #36895: If we autoload the `PDOConnection` from DBAL 2.x during a test on php8, our test suite goes 💥 What this PR does: * Some more Cache tests are skipped if DBAL 2 is installed on php 8. * The Lock and Messenger components are tested against DBAL 3. Commits ------- 7dc3f9c Don't execute tests with DBAL 2.x on php 8.
2 parents 6e0593f + 7dc3f9c commit 098d84a

File tree

6 files changed

+25
-2
lines changed

6 files changed

+25
-2
lines changed

src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

14+
use Doctrine\DBAL\Version;
1415
use Psr\Cache\CacheItemPoolInterface;
1516
use Symfony\Component\Cache\Adapter\PdoAdapter;
1617
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;
@@ -30,6 +31,10 @@ public static function setUpBeforeClass(): void
3031
self::markTestSkipped('Extension pdo_sqlite required.');
3132
}
3233

34+
if (\PHP_VERSION_ID >= 80000 && class_exists(Version::class)) {
35+
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
36+
}
37+
3338
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache');
3439

3540
$pool = new PdoAdapter('sqlite:'.self::$dbFile);

src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Lock\Tests\Store;
1313

1414
use Doctrine\DBAL\DriverManager;
15+
use Doctrine\DBAL\Version;
1516
use Symfony\Component\Lock\PersistingStoreInterface;
1617
use Symfony\Component\Lock\Store\PdoStore;
1718

@@ -30,6 +31,10 @@ public static function setUpBeforeClass(): void
3031
{
3132
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_lock');
3233

34+
if (\PHP_VERSION_ID >= 80000 && class_exists(Version::class)) {
35+
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
36+
}
37+
3338
$store = new PdoStore(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]));
3439
$store->createTable();
3540
}

src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Lock\Tests\Store;
1313

14+
use Doctrine\DBAL\Version;
1415
use Symfony\Component\Lock\Key;
1516
use Symfony\Component\Lock\PersistingStoreInterface;
1617
use Symfony\Component\Lock\Store\PdoStore;
@@ -30,6 +31,10 @@ public static function setUpBeforeClass(): void
3031
{
3132
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_lock');
3233

34+
if (\PHP_VERSION_ID >= 80000 && class_exists(Version::class)) {
35+
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
36+
}
37+
3338
$store = new PdoStore('sqlite:'.self::$dbFile);
3439
$store->createTable();
3540
}

src/Symfony/Component/Lock/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"psr/log": "~1.0"
2121
},
2222
"require-dev": {
23-
"doctrine/dbal": "~2.5",
23+
"doctrine/dbal": "^2.5|^3.0",
2424
"predis/predis": "~1.0"
2525
},
2626
"conflict": {

src/Symfony/Component/Messenger/Tests/Transport/Doctrine/DoctrineIntegrationTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Messenger\Tests\Transport\Doctrine;
1313

1414
use Doctrine\DBAL\DriverManager;
15+
use Doctrine\DBAL\Version;
1516
use PHPUnit\Framework\TestCase;
1617
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
1718
use Symfony\Component\Messenger\Transport\Doctrine\Connection;
@@ -28,6 +29,13 @@ class DoctrineIntegrationTest extends TestCase
2829
/** @var string */
2930
private $sqliteFile;
3031

32+
public static function setUpBeforeClass(): void
33+
{
34+
if (\PHP_VERSION_ID >= 80000 && class_exists(Version::class)) {
35+
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
36+
}
37+
}
38+
3139
protected function setUp(): void
3240
{
3341
$this->sqliteFile = sys_get_temp_dir().'/symfony.messenger.sqlite';

src/Symfony/Component/Messenger/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"psr/log": "~1.0"
2121
},
2222
"require-dev": {
23-
"doctrine/dbal": "^2.6",
23+
"doctrine/dbal": "^2.6|^3.0",
2424
"psr/cache": "~1.0",
2525
"doctrine/persistence": "^1.3",
2626
"symfony/console": "^3.4|^4.0|^5.0",

0 commit comments

Comments
 (0)
0