Problem/Motivation
WebformBreadcrumbBuilderTest uses @dataProvider methods. These must be static in PHPUnit 10 and newer.
This is currently causing a test failure and a phpstan error.
Proposed resolution
Make these methods static.
Remaining tasks
Implement.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork webform-3538392
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:
Comments
Comment #2
divyansh.gupta commentedWorking on it!!
Comment #4
divyansh.gupta commentedMade the changes
Please review!!
Comment #5
liam morlandThe methods that need to be changed are not the ones that have a
@dataProviderannotation. It is the methods named in the@dataProviderannotation. See the phpstan reports for the current 6.3.x branch. Also, making a method static requires removing all use of$thisinside the method.Comment #6
cilefen commented@divyansh.gupta: Just to clarify further: It is not only removing usages of
$this, but refactoring to maintain the same functionality.Comment #8
idebr commentedThe WebformBreadcrumbBuilderTest @dataProvider is now a static method
Comment #9
borisson_There are still several test failures in the latest test-run, will those all be fixed in this issue or in several other issues?
I would suggest doing it all in this issue, since that would reduce the number of needed rebases for the other patches in the queue
Comment #10
liam morlandIt would be great to be everything passing and I'm OK with doing it all in this issue.
Comment #11
liam morlandCan someone explain the adding of
#[LegacyModuleImplementsAlter]? Is this completing work from another issue?Comment #15
liam morlandTest are now passing on 6.3.x on Drupal 10. Now let's get them to pass on Drupal 11.
Comment #16
liam morlandComment #17
jrockowitz commentedBelow are the remaining broken tests. I am going to take a crack at this now.
Comment #18
jrockowitz commentedA bunch of the tests are broken due to changes in the rendered output, and the few remaining broken tests are a bit trickier.
Fixed
aria-required="true"attributeresize-verticalto textarearesize-verticalto textarearesize-verticalto textareaimage_file_jpg_modal.jpg.webptoimage_file_jpg_modal.jpg.avifaria-required="true"attributeresize-verticalto textareaaria-required="true"attributeresize-verticalto textareaaria-required="true"attributearia-required="true"attributearia-required="true"attributearia-required="true"attributearia-required="true"attributearia-required="true"attributeTDB
Comment #19
jrockowitz commentedFixed
container_rebuild_required: truein *.info.Needs work
Comment #20
jrockowitz commentedFixed
$webform_scheduleComment #21
jrockowitz commentedHmm... I am seeing random test failures with the below errors, which I think is more of a CI/CD issue.
Comment #22
jrockowitz commentedWoot! All the tests are passing without any major code changes.
https://git.drupalcode.org/project/webform/-/pipelines/576493
I think we should merge this and move on to preparing for stable D11 release.
Comment #23
liam morlandFantastic!
At lot the changes could avoid having a different test in Drupal 10 and 11 if they used XPath. That allows the test to test for the needed elements and attributes without checking for the exact markup.
Is adding
LegacyModuleImplementsAlterrelated to #3487957: Discuss process for converting webform to OOP Hooks? Perhaps it should have its own commit attached to that issue. That change also introduces a phpstan error. It should have an exception added.Comment #24
jrockowitz commentedI am open to any MR that converts HTML checks to XPath.
I added
use Drupal\Core\Hook\Attribute\LegacyModuleImplementsAlter;to webform.module. Let's see if PHPStan is now okay.Comment #25
jrockowitz commentedI had no idea the conversion to XPath was that simple.
In PHPStorm, I was able to prompt AI to "Convert to `responseContains` to `elementExists` with XPath" for a single assertion and it worked, but I don't have AI support setup for the whole webform code base yet.
@lkmorlan Do as much work as you feel comfortable and if the tests are passing you can merge this at anytime.
Comment #26
liam morlandI did one XPath conversion manually. Even manually is pretty simple. I hadn't thought it trying a LLM on it.
phpstan is happy with
LegacyModuleImplementsAlternow (though not on Drupal 10). Is that addition a follow-up to #3487957: Discuss process for converting webform to OOP Hooks? If so, I'll can move that into a separate commit.Comment #27
jrockowitz commentedI did not add the `LegacyModuleImplementsAlter`, but it seems to be okay. Feel free to move it to a separate commit.
Comment #28
jrockowitz commented@liam, could we please merge this sooner rather than later, because we will need to update a lot of existing MRs to ensure all the tests are passing?
Comment #35
liam morlandTests are now passing on 6.3.x. Thanks all!
Comment #36
borisson_I'm not super familiar with the new contribution records yet, but it seems like no one has gotten credit for this issue yet?
Comment #37
jrockowitz commented@borisson_ Thank you for the nudge to assign credits