Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Following #3252010: Lock PHPUnit to 9.5 Drupal 10 supports PHPUnit 9 only. There are some version-specific code sections that handle various cases in PHPUnit 8, these can now be removed.
Steps to reproduce
Proposed resolution
Remaining tasks
Decide what to do about the drupal-phpunit-upgrade
script, as this is no use for now but may be needed for PHPUnit 10.
In #3252010-19: Lock PHPUnit to 9.5. it was decided to keep the drupal-phpunit-upgrade
script.
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#23 | interdiff_21_23.txt | 2.04 KB | beatrizrodrigues |
#23 | 3252257-23.patch | 13.47 KB | beatrizrodrigues |
|
Comments
Comment #2
longwaveThere might be more that I missed, but this can all be safely removed at least.
Comment #3
mondrakeWe need to do #3182103: Ensure correct signature for setUp(), tearDown(), setUpBeforeClass(), and assertPostConditions() methods beforehand, I suppose.
Comment #4
mondrakeAnd in any case, I think we cannot do that if we want to keep a Symfony FC polyfill for upcoming PHPUnit versions.
Comment #5
longwaveAh yeah we need to keep parts of the ClassWriter for future compatibility. Should we move it to a neutral namespace though, so we can delete the PhpUnit8 namespace?
Comment #6
mondrake#5 yes that makes sense and is in line with a comment that I saw somewhere by @alexpott that I cannot find right now. I'd suggest to just step one back and put the class in the
Drupal\TestTools\PhpUnitCompatibility
.Comment #7
longwavePostponed on #3182103: Ensure correct signature for setUp(), tearDown(), setUpBeforeClass(), and assertPostConditions() methods
Comment #8
SpokjeUnpostponing since #3182103: Ensure correct signature for setUp(), tearDown(), setUpBeforeClass(), and assertPostConditions() methods was committed.
Comment #9
paulocsNew patch that addresses #6.
Comment #10
paulocsComment #11
Spokjesome more candidates
Comment #12
longwaveThanks, this is much better than my attempt in #2.
One more change that I think is safe:
We can drop the class alias and extend the DefaultResultPrinter directly now.
Comment #13
mondrake#12 hmpf, I agree it's better to clean up now, even if when PHPUnit10 will be out some swapping will still be necessary. But I do not think we can anticipate that yet.
Comment #14
SpokjeThanks @longwave, was already pondering if this class alias was needed any more, removed in attached patch.
Also removed PHPUnit 8 deprecations in
\Drupal\Tests\Listeners\DeprecationListenerTrait
.Let's see how TestBot likes it...
Comment #15
SpokjePersonally I'm a fan of removing it. Unused code = dead code = gone IMHO.
If re-needed, it can be archaeologized back to life from the repo.
Comment #16
longwave@mondrake yeah I couldn't easily decide, but from what I have seen the PHPUnit 10 event system will mean even more of a rewrite is required here, so we don't know yet whether this layer will be useful or if we will need something more complicated, and as @Spokje points out we can always resurrect it from git history if we do need it.
Comment #17
SpokjeComment #18
mondrakere #15 please leave the update script in, see also #3252010-19: Lock PHPUnit to 9.5.
Comment #19
SpokjeComment #20
SpokjeThanks @mondrake, updated IS to reflect the fact that the
drupal-phpunit-upgrade
script will remain.Comment #21
SpokjeComment #22
mondrakeThis is all PHPUnit 9 then now. Please leave it in the comment so that in the future when PHPUnit 9 will go away, we know we can remove the entire section.
This should remain because it's testing the conversion of PHPUnit warning to deprecations in general regardless of the version.
Comment #23
beatrizrodriguesI'm sending a new patch that addresses #22.
Comment #24
beatrizrodriguesComment #25
mondrakeRe. #12, I think it's OK as work in #3217904: [meta] Support PHPUnit 10 in Drupal 11 shows how the implementation of event subscribers will not cross at all with existing listeners, they will be rewritten in totally separate namespaces.
I went through it again and I think it's good to go.
dot missing at the end of the comment, this could also be fixed on commit. Strange phpcs doesn't complain.
Comment #26
alexpottFixed the full stop on commit.
Committed eb1adb0 and pushed to 10.0.x. Thanks!
Comment #29
neclimdulThis broke the compatibility class rewriter by not fixing the hard coded directory path to the simpletest directory. As noted int he follow up, not sure how this wasn't caught but its a simple enough fix.
#3259158: PhpUnit compatibility broken
Comment #30
mondrakeWe forgot a bit, opened #3261262: Remove PHPUnit 8 warnings conversion to deprecations.