liip / LiipTestFixturesBundle

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

[3.x] chore: remove support of PHP 7.4 and 8.0 #280

Closed alexislefebvre closed 5 months ago

alexislefebvre commented 5 months ago

See:

alexislefebvre commented 5 months ago

There was an issue with the MongoDB test with composer update --prefer-lowest because it installed doctrine/mongodb-odm-bundle 4.x and there was an error that I can't reproduce.

It randomly appeared when I ran docker-compose exec php-fpm ./vendor/bin/phpunit tests/Test/ConfigMongodbTest.php --debug several times.

The minimal version for doctrine/mongodb-odm-bundle is now 5.0.


Update: here is the error (?):

$ docker-compose exec php-fpm ./vendor/bin/phpunit tests/Test/ConfigMongodbTest.php --debug
PHPUnit Started (PHPUnit 10.5.11 using PHP 8.1.27 (cli) on Linux)
Test Runner Configured
Test Suite Loaded (1 test)
Event Facade Sealed
Test Runner Started
Test Suite Sorted
Test Runner Execution Started (1 test)
Test Suite Started (Liip\Acme\Tests\Test\ConfigMongodbTest, 1 test)
Test Errored (Liip\Acme\Tests\Test\ConfigMongodbTest::testLoadFixturesMongodb)
Deprecated: Return type of Doctrine\ODM\MongoDB\APM\CommandLogger::commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) should either be compatible with MongoDB\Driver\Monitoring\CommandSubscriber::commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /application/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/APM/CommandLogger.php on line 47
Deprecated: Return type of Doctrine\ODM\MongoDB\APM\CommandLogger::commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) should either be compatible with MongoDB\Driver\Monitoring\CommandSubscriber::commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /application/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/APM/CommandLogger.php on line 52
Deprecated: Return type of Doctrine\ODM\MongoDB\APM\CommandLogger::commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) should either be compatible with MongoDB\Driver\Monitoring\CommandSubscriber::commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /application/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/APM/CommandLogger.php on line 62
Test Suite Finished (Liip\Acme\Tests\Test\ConfigMongodbTest, 1 test)
Test Runner Execution Finished
Test Runner Finished
PHPUnit Finished (Shell Exit Code: 2)
alexislefebvre commented 5 months ago

We need processIsolation="true" or #[RunTestsInSeparateProcesses] because different kernels are loaded, but it hides errors and PHPUnit report successful tests as deprecated instead of success.

alexislefebvre commented 5 months ago

There was an issue with the MongoDB test with composer update --prefer-lowest because it installed doctrine/mongodb-odm-bundle 4.x and there was an error that I can't reproduce.

It randomly appeared when I ran docker-compose exec php-fpm ./vendor/bin/phpunit tests/Test/ConfigMongodbTest.php --debug several times.

The minimal version for doctrine/mongodb-odm-bundle is now 5.0.

It requires symfony/framework-bundle: ^6.4 || ^7.0 so --prefer-lowest makes less sense. :grimacing:

alexislefebvre commented 5 months ago

The actual error was:

PHPUnit\Framework\Exception: Deprecated: Return type of Doctrine\ODM\MongoDB\APM\CommandLogger::commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) should either be compatible with MongoDB\Driver\Monitoring\CommandSubscriber::commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /application/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/APM/CommandLogger.php on line 47

Using "doctrine/mongodb-odm": "^2.5" fixed the issue.