Closed (fixed)
Project:
Drupal core
Version:
10.0.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 Mar 2022 at 17:35 UTC
Updated:
1 Jul 2022 at 14:49 UTC
Jump to comment: Most recent
Comments
Comment #3
mondrakeComment #4
mondrakeComment #5
mondrakeComment #6
mondrakeComment #7
alexpottNice work @mondrake - it's great to have this functionality pushed upstream. I always hoped the baseline generation would replace this but moving this functionality upstream makes sense as well.
Comment #8
mondrakeComment #9
mondrakererolled
Comment #10
mondrakeComment #11
mondrakeParent issue was resolved, this can be worked on now.
Working on it.
Comment #12
mondrakeComment #13
mondrakeJust rebased for now.
Comment #14
mondrakeAdded Symfony 6.1 deprecations to the ignorefile
Comment #15
longwaveGood that this is all pushed upstream instead, some minor questions but overall this is great work.
Comment #16
mondrakeThanks @longwave, replied in the MR
Comment #17
mondrakeThanks @alexpott
Comment #18
mondrakeComment #19
mondrakeSee https://drupal.slack.com/archives/C1BMUQ9U6/p1653144878046959
I also think that a big chunk of deprecation testing could be moved to static analysis, as well as Drupal's listeners implementations that deal with coding standards for example.
But I also think that we will still have a part of the deprecations (conditional ones for example, or some of those triggered by vendor packages) that PHPStan may miss, so the feature implemented here will stay, and in fact it helps in the future endeavour to remove listeners.
Comment #20
longwaveGreat work. We are removing a whole bunch of custom code and replacing it with a few lines that defer to upstream, along with a separate config file that's easier to use than what we had before.
Comment #21
longwave...although this only works for people who use run-tests.sh. If you run phpunit directly, deprecations are now shown in the CLI.
Before:
After:
Comment #22
mondrakeYes, we need to include instructions in the CR. In essence, to run deprecation testing with ignoreFile in your project you will have to make sure that the environment variable SYMFONY_DEPRECATIONS_HELPER is set like
SYMFONY_DEPRECATIONS_HELPER=ignoreFile={deprecation_ignore_filename}either in the phpunit.xml file or in the CI scripts you're using.
The obvious benefit is that you can specify any ignoreFile, not necessarily Drupal's core, so this also addresses #3143388: Allow projects to add to the list of skipped deprecations.
Comment #23
longwaveHow about setting the default in phpunit.xml.dist?
Annoyingly though it depends on which directory you run PHPUnit from, so maybe we should just document it there but left commented out.
Comment #24
mondrakeYes, that’s the reason why I moved it to run-tests… needs to be absolute path, too: apparently the testing framework runs kernel tests with a different cwd than other suites
Comment #25
mondrakePer #23, added hopefully-not-too-verbose comments in phpunit.xml.dist.
Comment #26
longwaveI think that is a fine way of explaining it.
I suspect this might need a release note snippet as it affects users who run tests, but will leave that to core committers to decide.
Comment #27
catchThis is borderline for release notes for me since it won't affect site owners as such just people running tests. However we should put instructions in the change record which currently just says @todo.
Comment #28
alexpottWe can also consider updating the phpunit bridge to 6.1 on Drupal 9 - that would allow us to get this in earlier. FWIW maybe we should fix the CWD inconsistency as that would make this simpler and have other benefits - most notably consistency and the principle of least surprise.
Comment #29
longwave@alexpott unfortunately the path entirely depends on how you run PHPUnit. The following are equivalent:
so I'm not sure how we can make this consistent.
Maybe upstream can fix so ignoreFile is relative to the PHPUnit configuration directory instead of cwd?
Comment #30
mondrakePut some flesh on the CR.
Comment #31
mondrake#29 the same issue is for the baselineFile, upstream. Not sure what can be done upstream since there is no notion of the location of the PHPUnit config, IIRC
#28 is backport really worth? 9.4.x should not add more ignores to the list, and items can only be removed from the list in 10.0.x
Comment #32
alexpottActually I think we can make this simpler. We can set the SYMFONY_DEPRECATIONS_HELPER envvar in core/tests/bootstrap.php if it is not set instead of run-tests.sh. That way we provide todays behaviour without any change.
Comment #33
mondrakeon that
Comment #34
mondrakeComment #35
longwavePerfect - this works for me locally running vendor/bin/phpunit without having to set an env var at all, but if I do set the variable then it overrides the core default.
However the change record needs updating again as this has all been simplified and we don't need to tell people to update their setups, only if they want custom deprecations now.
Comment #36
mondrakeUpdated CR and some comments inlined in phpunit.xml.dist
Thanks for reviews!
Comment #37
longwaveThanks, the documentation changes all look good to me.
Comment #38
longwaveRe backport I believe we cannot add new deprecations to 9.4.x now or removals in 10.0.x, now but we might want to add some to 9.5.x and 10.0.x for removal in 11.0.0, so maybe it is worth it? Not sure.
Comment #39
catchWe'll end up with a handful of 9.5.x deprecations for removal in 10.0.0 or 11.0.0, but I don't think we'd need to add them to the skipped deprecation list - we'd be removing the usages too at the same time. It's possible we might need to use it for PHP 8.2 stuff though as we have with EasyRDF - but we only have one of those currently for PHP 8.1, so not sure it's worth trying to backport for that either.
Comment #41
catchCommitted d77a68d and pushed to 10.0.x. Thanks!
Comment #43
mondrakePublished CR.