Closed (fixed)
Project:
Drupal core
Version:
8.8.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2019 at 12:24 UTC
Updated:
6 Sep 2019 at 12:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mondrakeComment #3
mondrakeFirst cut, let's see what breaks
Comment #4
mondrakeComment #6
mondrakeNot bad... correcting Error and ExpectationFailedException namespaces.
Comment #8
mondrakeComment #9
mondrakeLet's do conversions of
\PHPUnit_Framework_MockObject_MockBuilderas a follow-up, these are just replaces but their sheer number blows the size of the patch.Here without those conversions. Patch should be simpler to review.
Comment #11
mondrakeComment #12
mondrakeComment #13
mondrakeReroll after #3059090: Deprecate \Drupal\Tests\PhpunitCompatibilityTrait::setExpectedException(); more conversions from FQCN to ::class needed, but later on :)
Comment #14
mondrakeWorking on conversions from FQCN to ::class
Comment #15
mondrakeThis removes all the FQCN in code and the legacy listeners that are dead code now.
Comment #16
lendudeThis is a BC layer, so removing this could/would be disruptive to contrib.
At the very least we need a Change Record. But maybe the removing of the BC part needs to wait for D9, and we can only clean up core dependencies on the BC layer, probably depending on how disruptive we think this to be.
Comment #17
lendudeUgh, old page submitted, files in #15 got hidden, but I can't show them, they are not in my files list?
Comment #18
alexpottI think we can only remove this in Drupal 9. Maybe the best way here is to do this in a deprecated way - ie. add classes that are deprecated but extend the PHPunit class. That way we can do the removal cleanly.
Comment #19
mondrakeReleasing, AFK at the moment
Comment #20
mondrakeOn it
Comment #21
mondrakeLinked already existing CR.
Addressed #18, although it's tricky - you cannot place @trigger_error at the beginning of the deprecated classes - bootstrap.php loads them with class_alias very early, and the excpetion is not captured by the tests. If you change class_alias(es) to not autoload the original class, then tests won't find the aliased one. So I did some workarounds, see the code.
Comment #22
jibranWhy can't we just break BC here? Every major release has broken tests for me(See DER HEAD test issue). It is not breaking any runtime code it will just break the tests which can be fixed after updating phpunit which you are supposed to do and then replacing some use statements. I think a proper CR would the job. Last interdiff feels like maintaining PHPUnit 4 in core.
Comment #23
mile23The scope here is usage according to the IS. Let's remove usages of
Old_Skool_PHPUnit_Test_Classesfor this issue, and then remove the aliasing in a follow-up. That gives us a relatively easy review, and we can decide which supported version of PHPUnit we want to target in the near future before we decide on how BC works. #2950132: Support PHPUnit 7 optionally in Drupal 8, while keeping support for ^6.5 #3039275: phpunit-mock-objects is marked as "abandoned" when composer.lock is rebuilthttps://phpunit.de/supported-versions.html
Comment #24
mondrake#23
Makes sense. Deprecation here seems overkill - and BTW since several classes are exceptions that are likely caught in try...catch blocks, it's not even guaranteed it will work, because the unaliased code will be used inside PHPUnit.
So here removing the deprecation circus - but leaving tests checking the existence of aliased classes (some of the original classes will move in . PHPUnit 7, so a test will help check they are still available until the aliases are eventually removed.
Comment #25
mile23Here's the follow-up: #3063182: Remove PHPUnit 4.8 class aliasing BC layer
Comment #26
mondrakeneeds reroll
Comment #27
mondrakeReroll
Comment #29
mondrakeBetter reroll. Forget #27...
Comment #30
mile23Added follow-up issue based on #9: #3073318: Remove usages of \PHPUnit_Framework_MockObject_MockObject
I verified that a search for 'PHPUnit_' only yields MockObject references which will be handled above, or references within the aliasing code, which will be handled in #3063182: Remove PHPUnit 4.8 class aliasing BC layer
LGTM.
Comment #31
mondrakeRerolled.
Comment #32
wim leersNICE! 👏
Comment #33
mondrakeReroll. Only context changes.
Comment #34
catchComment #35
catchCommitted 50a6a9e and pushed to 8.8.x. Thanks!
Comment #37
wim leersI think #3063182: Remove PHPUnit 4.8 class aliasing BC layer and #3073318: Remove usages of \PHPUnit_Framework_MockObject_MockObject are next?
Comment #38
mondrake#37 yes, correct.
Updated the CR to mention deprecation of aliased classes, https://www.drupal.org/node/3056869/revisions/view/11455817/11540436