liip / LiipTestFixturesBundle

This bundles enables efficient loading of Doctrine fixtures in functional test-cases for Symfony applications
https://liip.ch
MIT License
169 stars 45 forks source link

feat: add support for dbal 4 #299

Open Chris53897 opened 7 months ago

Chris53897 commented 7 months ago

https://github.com/liip/LiipTestFixturesBundle/issues/298

Maybe the only problem is this change. https://github.com/doctrine/dbal/blob/4.0.x/UPGRADE.md#bc-break-renamed-sqlite-platform-classes

TODO: I know there must be a bc layer for dbal < 4

Chris53897 commented 7 months ago

Solving https://github.com/liip/LiipTestFixturesBundle/issues/300 would help development.

alexislefebvre commented 7 months ago

On the 3.x branch, with doctrine/dbal 4, this line is not working:

https://github.com/liip/LiipTestFixturesBundle/blob/696c0e0c8a80aac44905fe7695420f552579cc09/src/Services/DatabaseToolCollection.php#L52

$this->items[$registry->getName()][$driverName] is evaluated as false, null or whatever and it switch to the statement after ??.

Update: you found the issue: DatabaseToolCollection registers an item with key Doctrine\DBAL\Platforms\SqlitePlatform then later the key Doctrine\DBAL\Platforms\SQLitePlatform is searched.

alexislefebvre commented 7 months ago

Please check this:

Feel free to backport it to the 2.x branch.

alexislefebvre commented 7 months ago

Tests were OK on local environment but not on CI, because the versions of databases used on GitHub Actions were outdated: https://github.com/liip/LiipTestFixturesBundle/pull/306/commits/bf29b7d7c50280f6f96a38dd8eede57ec7529355