-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update code for compatibility with PHP8 #366
Comments
Running PHP Compatibility checks for PHP >= 7.3 with
The errors are all in the Kohana system code (plus a test in a vendor supplied library by the look of it) |
The errors in the system folder are given by
None of these are new deprecations suggesting that, if they haven't bitten us yet, then they probably won't do so now. |
Current situation is that I am stuck on unit testing for PHP8 as we have a dependency on DbUnit which is obsolete. |
Although I don't like this as a solution, do we need a re-written set of tests that work in recent PHPUnit versions? |
I have modified all the tests so that they are working with the latest version of PHPUnit. The issue is with our modules/phpUnit/libraries/Indicia_DatabaseTestCase which inherits from PHPUnit\DbUnit\TestCase. A possible solution is to include the source code of DbUnit in our repo and keep it compatible with changes to PHPUnit. However, the justification for DbUnit being abandonned was
So that is the other possible solution. |
I just pushed some work I did a while back so it doesn't get lost. This is working towards replacing DbUnit by creating my own, very simple, drop-in alternative for creating fixtures. All the current tests which manipulate the database would need updating to follow this pattern and then DbUnit could be discarded. That would enable us to switch to PHP8 without losing our ability to run the tests. |
@JimBacon it might be helpful to know what changes are required to existing tests - is it only when fixtures are used to predefine data? If so then this may only affect a handful of tests (other than whatever is required to update the main fixtures). |
It is just about tests where we set up a database with pre-defined data. I haven't got a clear idea of how much work that is but manageable, I imagine. I don't feel like I have necessarily understood all the things that DbUnit does but my first attempt to replace it seemed to work okay. To update the test
The diff makes the changes look more significant that they were because there was a change of indent to the local fixture definition. If you are developing any new tests, it would be great if you could move in this direction. Very happy for you to offer any improvements to what I have done. (Its all in the PHP8 branch at present but a merge with dev would probably not cause a problem.) |
I just noticed that the master branch of https://github.com/misantron/dbunit does support PHP8 but it has not been released on packagist. By making use of this version, I have been able to run the unit tests with PHP8. That revealed some compatability issues which I fixed so all the tests pass. I have merged the work in to the develop branch and set Travis to run the unit tests on both PHP7.3 and PHP8.0 henceforth. Although the test coverage is limited, and there may still be a few compatibility issues lurking, I'm going to close this issue. It is probably a good idea to continue moving away from using DbUnit but it is no longer blocking us. |
Relates to BiologicalRecordsCentre/iRecord#1047
Also update check_php_version() in modules/indicia_setup/helpers/config_test.php and the installation docs at https://indicia-docs.readthedocs.io/en/latest/administrating/warehouse/warehouse-installation.html
The text was updated successfully, but these errors were encountered: