APY / APYDataGridBundle

Symfony Datagrid Bundle
MIT License
492 stars 344 forks source link

Feature/PHP8 #1068

Closed npotier closed 1 year ago

npotier commented 2 years ago

Work in Progress

The code has been refactored using rector. PHPUnit has been upgraded, and the tests has been partially rewritten in order to comply with this new version.

Test are failing when some MongoDB classes declared as final are mocked:

example :

$ php vendor/bin/phpunit
...
196) APY\DataGridBundle\Grid\Tests\Source\DocumentTest::testGetTotalCountWithMaxResults
PHPUnit\Framework\MockObject\ClassIsFinalException: Class "MongoDB\Driver\Cursor" is declared "final" and cannot be doubled

/Users/nicolaspotier/www/APYDataGridBundle/Tests/Grid/Source/DocumentTest.php:1157
/Users/nicolaspotier/www/APYDataGridBundle/Tests/Grid/Source/DocumentTest.php:1022
/Users/nicolaspotier/www/APYDataGridBundle/Tests/Grid/Source/DocumentTest.php:898

I've tried to use https://github.com/dg/bypass-finals, but without success.

if you have any idea on how to bypass this issue, feel free to tell it here. Otherwise, it might be necessary to rewrite the logic of the test.

Hanmac commented 2 years ago

@npotier this user did get the hook working

https://github.com/northernco/NorthernDatagridBundle/commit/925e9af5b018965c31bf6c1a30ba34f014246aeb

fkrauthan commented 2 years ago

Looks good. Any progress on getting PHP 8.x compatibility? I recently upgraded another project (that is not using this bundle) and was gonna tackle my project that is using this bundle next.

npotier commented 1 year ago

Hello, updates from this MR:

I have rewritten all the tests in order to make them works with new version of PHPUnit. I also have added a Github Action that launches the tests.

I will release this version as a beta for a while and then, if the feedbacks are good, release it as a new version

npotier commented 1 year ago

OK. It is merged on master and tagged as 5.0.0-beta 🤞