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
Follow-up from #3351236: Fix PHPStan L1 errors "Missing call to parent::setUp()/tearDown() method.".
In parent we left out fixing DrupalKernelTest::setUp(). That needs a change to KernelTestBase too, so it's worth discussing it here separately.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|
Issue fork drupal-3354063
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3354063-fix-missing-call changes, plain diff MR !4055
Comments
Comment #2
mondrakeHere's a patch.
Comment #3
smustgrave CreditAttribution: smustgrave at Mobomo commentedMarking this but there are 135 instances of Missing call to parent how are they being covered?
Comment #4
mondrake#3 see parent issue
Comment #5
longwaveHm, can DrupalKernelTest just override
bootKernel()
to do nothing?Comment #6
mondrakePersonally, I think this is more readable and gives more flexibility, than starting to override the base methods that setup the environment. Also, this is kind of a reference issue for further work - there are other similar issues (see #3351236: Fix PHPStan L1 errors "Missing call to parent::setUp()/tearDown() method.") but for BrowserTestBase.
Comment #7
joachim CreditAttribution: joachim as a volunteer commentedIf this method is about the boot level, could we give it a name that reflects that?
I'm really not keen on Foo()/doFoo() pairs.
Comment #8
mondrakeWould
::kernelSetUp()
be a better option?Comment #9
longwavebootKernel()
is currently private presumably because we don't really want downstream users messing with the kernel setup. Except in this test, where we do! I personally think the simplest solution is to makebootKernel()
protected instead and then just override it. If other kernel tests really want to mess with the boot process we shouldn't stop them; I would perhaps argue differently if this was in runtime code, but as it's tests-only I think we can and should be more flexible here.Comment #10
mondrakeUhm then I think we should enlarge the scope of this issue to all remaining cases, and find a solution across them all.
Comment #11
longwaveAttached patch handles all remaining missing calls to
parent::setUp()
. I think there is further simplification that can be done in UpdatePathTestBase (zlib check, update URL generator, etc) but that can be deferred to a followup.Comment #12
mondrakeLooks good and fixes the PHPStan reported errors. I would have preferred my own way… but that’s not matter to prevent rtbc. Thanks!
Comment #13
mondrakeneeds rebase
Comment #14
longwaveComment #15
smustgrave CreditAttribution: smustgrave at Mobomo commentedRebase seems good.
Comment #16
quietone CreditAttribution: quietone at PreviousNext commentedNeeds a reroll.
longwave suggested a followup in #11. Has that been made?
Comment #17
Gauravvvv CreditAttribution: Gauravvvv at Axelerant for Drupal India Association commentedRe-rolled patch #14. Removed re-rolled tag. please review
Comment #18
mondrakeBack to RTBC
Comment #19
SpokjeRerolled, opened follow-up #3360167: Simplification in UpdatePathTestBase (thanks @quietone)
Comment #21
SpokjeComment #22
SpokjeLooks like a random fail: https://www.drupal.org/project/drupal/issues/2829040#comment-15050937
Comment #23
smustgrave CreditAttribution: smustgrave at Mobomo commentedYea a number of tickets are getting this random
Comment #25
SpokjeComment #27
SpokjeRerolled 3354063-19_0.patch on 11.x-dev in MR
Comment #30
longwaveCommitted and pushed 7e4ecad537 to 11.x (10.2.x). Thanks!