-
Notifications
You must be signed in to change notification settings - Fork 824
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
Use a PHP8 compatible version of phpunit #9832
Comments
Option A will only be feasible with --ignore-platform-reqs IMO, unless you want to fork the entire dependency chain of phpunit. I really don't think that's a good use of time :-/ Option B will require changing tests but can hopefully be doable module-at-a-time. The hardest thing will be kitchen sink tests, though, which assume commonly-installed dev depencies. I've also seen some projects that alter the tests with a simple regex rewrite in CI (adding void return type hints to setUp and tearDown) which might be doable as a bridging solution. It might also be possible to package that up as a script to run on each module. |
EDIT: Scratch that, this legitimately belongs as a separate issue. |
From @emteknetnz on #9668
I think we need to be clear about where it's important to drop
TL;DR: My advice would be proceed with #9668 with a focus on the testing of individual projects (or modules that don't form part of a kitchen-sink test) initially, and potentially leave it at that. |
I'm on board with your thinking on the other issue. I'll explain my perspective as a product dev a little better
I don't think the While this may work for now in the isolated use-case being able to install phpunit 5.7 on php8, it will hide other non-phpunit dependencies that don't match the version of PHP being used. This issue lists what currently gets installed on php8 when you use the As we move into php 8.1 and beyond, we could easily run into a situation where a modules have dependencies that requires php 8.1, though we mistakenly assume we can install it on php 8.0, and then we tag a release that can't actually be installed. I mentioned on the other issue that I consider forking ^5.7 phpunit to be technical debt. I also consider Moving forwardMy goal here is to get core things to "just work" on php8. I see
There's no way this will ever be PHP8 compatible without forking. There is no real appetite to keep these forks long term. So SapphireTest itself is also a blocker to PHP8 adoption, so as you recommend on the other issue it needs to be deprecated Things won't "just work" on php8 until all the modules require phpunit ^9.3 - we need to update all the things. I don't think there's away around this, it's just how it is. |
I guess I'm making the argument that forking the entire dependency chain of phpunit 5.7 is just as problematic as continuing to use
SapphireTest will forever be a phpunit5.7 support tool. Moving away from phpunit5.7 means moving away from SapphireTest. That's detailed in the other ticket.
Could we agree that 'short-term' is, e.g. a year? Then we can get some real experience with project code (or non-kitchen-sink modules) freeing themselves of SapphireTest and using phpunit 9 for their own tests. That way we could judge at that time whether it's better to migrate the framework and other tests away from SapphireTest, or keep propping up SapphireTest with a more complete phpunit 5.7 fork. FWIW I would probably take a "monorepo" approach if we were to do that, and inline the code of all the errant dependencies into It also means that we start by adding some value for project developers - the ability to move to phpunit 9 or other testing frameworks of their choice.
Giving ourselves until Christmas 2021 ("a year" minus a bit) fits with that deadline, more or less. |
We could certainly make short-term one-year. As a rule I do all my local dev in the lowest supported version of php which is currently 7.1, so day to day this doesn't block me. It does however increase the risk though that we'll get something wrong in terms of compatible requirements. My main concern driving all this is really that we'll prematurely announce "Silverstripe development works great with PHP8!", which may not be entirely accurate, or at least aggravates someone who heard the announcement but didn't read the nuanced release notes. I'm think we should be conservative with setting expectations otherwise we may be setting ourselves up for failure. Waiting one year, in my mind at least, goes against us confidently telling people they should switch their project to PHP8. It we can jettison SapphireTest for projects sooner rather than later I'm feeling more confident in PHP8 support. What's stopping bespoke developers from using something other that SapphireTest now, or even 2 years ago? Are projects forced to unit test with SapphireTest due to some technical reasons?
So if you kept this bootstrap.php in place, could you just write phpunit ^9 compatible unit test that |
We'll need to replicate most of this API surface for developers to be able (re)write their tests using |
Out of curiosity I just tried this locally, and got the following (somewhat passive aggressive) response from Composer:
So we'll need to explicitly remove the |
There's a massive amount of state management that currently only exists in SapphireTest. My recommendation in the other ticket is to refactor that to the test-state services, so that SapphireTest becomes a few trivial lines. |
Fair call; we probably want to frame this as "Experimental support for PHP8" until |
Closing as we're shipping PHPUnit 9.5 support with 4.10 |
AC's
--ignore-platform-reqs
flag(Strong preference) Do not require modification to any existing module unit testsOptions:
A) Update the sminnee fork of phpunit 5.7 to be php8 compatible, this may require also forking some downstream dependenciesB) Upgrade phpunit to ^9.3 which includes PHP8 support
There's an extended discussion here
The text was updated successfully, but these errors were encountered: