Closed (fixed)
Project:
Drupal core
Version:
11.1.x-dev
Component:
file system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
23 Jun 2023 at 01:30 UTC
Updated:
16 Dec 2024 at 04:59 UTC
Jump to comment: Most recent
Comments
Comment #2
kim.pepperComment #4
elberHi @kim.pepper should I move everything to a trait?
Comment #6
ultimikeThe Drupal Contribution Mentoring team is triaging issues for DrupalCon Barcelona 2024, and we are reserving this issue for Mentored Contribution during the event.
After September 27, 2024, this issue returns to being open to all. Thanks!
I plan on working on this issue with my team.
-mike
Comment #7
jacobupal commentedWe're working on this in our contrib table.
Comment #8
jacobupal commentedComment #9
jacobupal commented^^ Not anymore, our bad @ultimike! We thought the 'team' meant the whole mentoring team & newbies. Good luck!
Comment #11
drubolbol commented@nico059 and me have created a new file FileTestFormBase.php with the main common code for buildForm function that is extented by the other classes in the other files.
Comment #13
jacobupal commentedComment #14
ultimike@drubolbol and @nico059 did a great job during the DrupalCon Barcelona mentored core contribution day - making good progress on this issue (and learning a lot about the contribution process along the way.)
Currently, it appears that the changes have caused some tests to fail:
See https://git.drupalcode.org/issue/drupal-3368857/-/pipelines/294400 for more details.
-mike
Comment #15
mattlc commentedI tried to replace the abstract class by a trait in order to keep original class inheritance/interface implementation intact but the tests results are the same : the "Submit" button cannot be found by #14 stated failing tests.
Comment #16
nico059 commentedDear all,
I try also with Trait, and it work's but .... I think the problem with the 3 failed Test is "somewhere else" in the issue fork code. And NOT in the code done here to resolve this issue ...
What I have done ...
I modify the 3 files in repos/drupal/core/modules/file/tests/file_test/src/Form to use a new Trait:
- FileTestForm.php --> to use the Trait
- FileTestSaveUploadFromForm.php --> to use the Trait
- FileTestFormTrait.php --> the Trait itself
I have created a branch with this code here : https://git.drupalcode.org/issue/drupal-3368857/-/tree/3368857-remove-du...
Tests Works BUT ....
The following tests works:
Drupal\Tests\file\Functional\SaveUploadTest
Drupal\Tests\file\Functional\SaveUploadFormTest
Drupal\Tests\file\Functional\RemoteFileSaveUploadTest
BUT .... only if I test them a more recent issue fork
FYI, as I don't know HOW TO DEV in the latest 11.x Drupal version.... I choose a random other fork more recent to test (I choose 3478771-inputconfigurator-should-expose), and when I run them all works !!
Conclusion
I think something is "wrong" in the current issue fork (3368857) somewhere else
Perhaps is it possible to rebase ALL this issue fork with the latest core version ? And see if the Test works too ?
Comment #21
anand48 commentedI have pushed code based on @ultimike and @nico059's approach using an abstract class and the tests appear to pass now. I'm assuming there were some random Functional test failures but they pass once I rerun the pipeline.
Comment #22
smustgrave commentedThere are 3 MRs up but no clear indicator which should be reviewed. Also proposed solution section appears to be remaining tasks.
Comment #23
mattlc commentedHello,
Thank you @anand48, as discussed with both @nico059 and @ultimike at DC Bacelona Trait might be a better solution to keep a simple extension hierarchy.
I worked on the 3368857-remove-duplication-trait.
- minor code style issues fix
- rebased on 11.x
- force pushed to 3368857-remove-duplication-trait
So I think the MR to consider is 9792 from @nico059.
I set the status to Needs review.
Comment #24
smustgrave commentedMRs should be hidden,
But 9792 has errors.
Comment #25
mattlc commentedJust saw this. My bad.
I rework on it.
Sorry for that.
Comment #26
smustgrave commentedNo apology needed!
Comment #29
mattlc commentedFixed phpcs and phpstan errors.
Comment #32
smustgrave commentedIssues seems resolved and trait seems good to me.
Closed the other 2 MRs
Comment #33
quietone commentedThanks everyone for getting this to RTBC. There is just one thing, which I commented on in the MR. I know naming can be a challenge but I do think the method needs a better name.
Comment #34
Anonymous (not verified) commentedComment #35
Anonymous (not verified) commentedHi @quietone
I changed the name of the trait
FileTestFormTraittobaseFormas instructed.Please take a look
Thanks
Comment #36
ankitv18 commentedMinor suggestion regarding the naming convention of trait class ~~ hence moving back to NW.
Comment #37
Anonymous (not verified) commentedHey @ankitv18,
Thanks for pointing out the mistake.
In #33, @quietone mentioned:
I changed the trait name while I should have just changed the method name. I undid the unnecessary changes and changed the method name as suggested. Ran the tests and the pipeline is all green.
Thanks
Please review it now.
Comment #38
ankitv18 commentedLooks good now ~~ marking this one RTBC
Comment #39
Anonymous (not verified) commentedRebased and updated fork to latest
Comment #40
Anonymous (not verified) commentedThe pipeline was run after rebasing and tests are all green - no errors!
Comment #43
quietone commented@akulsaxena, Welcome to Drupal!
Committed to 11.x and cherry-picked to 11.1.x
Thanks!