Problem/Motivation
In order to get to PHPUnit 6 and PHP7.2 compatibility we had to change SYMFONY_DEPRECATIONS_HELPER
to weak_vendors
because we were triggering deprecation notices from our mocks. PHPUnit 6 has a neat new feature that triggers deprecation messages from mocks if the method has an @deprecated
annotation. So even if the method's real code has no @trigger_error
its mock will do. This is great because it allows us to find tests which are mocking deprecated methods but it tricky for Drupal 8 because we have methods that were deprecated before we had the @trigger_error
policy in place.
This was a hack to get around that. We should be on strict
so that all deprecations in core are either skipped or expected. Eventually we should get rid of the skipped deprecations too. See #2959269: [meta] Core should not trigger deprecated code except in tests and during updates.
When it is set to weak_vendors we don't trigger deprecation errors for things like #2961688: Fix "Using UTF-8 route patterns without setting the "utf8" option" deprecation because this deprecation is triggered by vendor code calling vendor code - even though it is our usage of the Symfony API that triggers it.
Proposed resolution
Probably add all the deprecations to skipped so at least we know the size of the work.
It's important to run the tests on both PHP 5.6 and PHP 7+ to get the difference between PHPUnit 4 and PHPUnit 6.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#24 | 2961691-2-24.patch | 30.17 KB | alexpott |
#24 | 22-24-interdiff.txt | 2.11 KB | alexpott |
#22 | 2961691-2-22.patch | 29.41 KB | alexpott |
#22 | 19-22-interdiff.txt | 2.99 KB | alexpott |
#19 | 2961691-2-19.patch | 28.98 KB | alexpott |
Comments
Comment #2
alexpottComment #4
alexpottWorking on making it not fail.
Comment #6
BerdirI guess it's easier to wait for that issue to land and then remove them. The only reason we're not seeing tons of these is because we use the extension on testbot, but anyone running the tests locally or elsewhere would still get them lots of other tests too?
just commenting on this as a cross-reference for #2949964: Add an EntityOwnerTrait to standardize the base field needed by EntityOwnerInterface as we have a similar case there.
Comment #7
alexpottYeah we should wait for both #2937543: Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0 and #2912169: Inject the argument resolver into HttpKernel::__construct. I try rolling everything on top of those.
Comment #8
alexpottHopefully fixed all the things.
The main patch includes the two linked in #7.
Comment #10
alexpottHopefully fixed the migrate issues.
Comment #13
alexpottRebased now #2937543: Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0 is in.
Comment #15
idebr CreditAttribution: idebr at ezCompany commentedI was about to do a courtesy reroll after #2962736: phpunit.xml.dist has an incorrect instruction on how to disable deprecation errors was committed. However, in #2962736-5: phpunit.xml.dist has an incorrect instruction on how to disable deprecation errors #5 @alexpott mentions:
In the patch the SYMFONY_DEPRECATIONS_HELPER value is updated to 'strict'.
In line with the comment in#2962736-5, I would like to suggest this environment variable is omitted completely, so its value will default to 'strict'. See ./vendor/symfony/phpunit-bridge/Tests/DeprecationErrorHandler/default.phpt or https://symfony.com/blog/new-in-symfony-2-7-phpunit-bridge :
Comment #16
alexpott@idebr good point. Rerolled
The patch includes #2912169: Inject the argument resolver into HttpKernel::__construct which will hopefully land soon.
Comment #18
alexpott#2970026: Fix "Passing a Session object to the ExpectationException constructor is deprecated as of Mink 1.7. Pass the driver instead." introduce a perfect example of why we need to make this change.
Comment #19
alexpottThe blocker is in.
Comment #20
alexpottUpdated issue summary to be clear about why we went to weak_vendors and to help explain some of the changes in the patch.
Comment #21
timmillwoodMaybe this should be moved down to the first place it's used now?
This seems useful enough to sit outside of FormUninstallValidatorTest.
Should these have docblocks?
Comment #22
alexpottThanks for the review @timmillwood.
1. Sure why not. Not strictly related to the patch but no reason not too.
2&3. Removed in favour of just mocking the URL object.
Comment #23
BerdirWas hoping to RTBC but found a few doc things that should be fixed.
I suppose it is very unlikely that anyone subclassed this..
change this to ::class while we move it around? you do it elsewhere..
wrong @var
missing description
was wondering if we should also remove this and rely on the default or whatever it is set, but I guess it's fine?
Comment #24
alexpottThanks for the review @Berdir.
Comment #25
Berdir1. Fair enough :)
Looks good now I think!
Comment #26
timmillwood+1 to RTBC
Re: #24.2 - I only suggested moving it because the usages had been removed, and the only remaining usage was now miles away to it seemed odd. Maybe we should open a follow-up to replace all getMock() usages to use ::class 😉.
Comment #27
catchwill be used. Fixed on commit.
Committed c2585a1 and pushed to 8.6.x. Thanks!