Needs work
Project:
Inline Entity Form
Version:
3.x-dev
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 Jun 2019 at 17:03 UTC
Updated:
9 Dec 2023 at 19:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lowfidelityInstead of passing the topmost parent IEF element to inline_entity_form_close_all_forms(...) in the button #submit callback closeChildForms(..) we only pass the IEF element that holds the clicked close button.
This only closes the IEF element holding the 'Cancel' button and all it's nested IEF elements, instead of closing all IEF elements inside the widget.
Comment #3
lowfidelityComment #4
geek-merlinThanks a lot! Code looks good. Tests are green.
I'd appreciate a comment on that line, what keys are sliced away. Makes the code more maintainable.
If someone else does a manual test and sets RTBC, we can commit this.
Comment #5
lowfidelityI added the comments.
Comment #6
geek-merlinOK, looks good! I missed that the new code does not have automated tests. Can you look into the existing tests and extend them to cover the new code?
Comment #7
lowfidelityI'll try to write those tests, but I have absolutely no experience with test driven development. I browsed through the docs and I think I understand the technical part of it. Though, I find it hard to decide what kind of tests are required in this particular case.
Also, can I simply add my code to existing tests if they are suitable or does every patch require it's tests in a separate file?
Could you please point me into the right direction? Any nice tutorials that explain the theoretical part of writing tests for Drupal?
Thanks a lot!
Comment #8
geek-merlinTHH, i'm not experienced at writing tests though, and i distract from this fact by nudging others to do so as maintainer. ;-) But hey, this is really important to have a complex (and ermm, partly convoluted) module like this maintainable.
As of pointers, look into the official docs and i think most important is to understand the types of tests: https://www.drupal.org/docs/8/testing/types-of-tests-in-drupal-8
> Also, can I simply add my code to existing tests if they are suitable or does every patch require it's tests in a separate file?
I think it is not only OK but a good thing to extend an existing test in a way that covers what you fix by this patch.
And do not cheap out on comments! They help others (including your future self ;-).
What you essentally do is
* In the issue summary, write a how-to-reproduce such that any moron will understand exactly what to click
* Write that in code
Ne next thing you do is
* upload a "test-without-fix" patch (which *must* turn out red and proves that your test tests what need be tested)
* in the same comment, upload the "test-plus-fix" patch (which then proves that the fix is a fix)
HTH!
Comment #9
joachim commentedI can confirm the patch fixes the problem.
The tests are quite complex and most of them seem to be set up with multi-level nesting, so it's not going to be simple to figure out where and how to add the test for this!
Comment #10
lowfidelityYeh. I've been using the patch in production for half a year, so I'm pretty sure it works as it should.
I also added all sorts of functionality, like selecting multiple referenced entitties and updating their fields, etc. I wrote up a little blog post about that here https://www.lowfidelity.at/blog/quick-edit-drupal-inline-entity-form
Also here's a related patch that allows "quick editing" related entities: https://www.drupal.org/project/inline_entity_form/issues/3127011
Still, I didn't find the time to get into writing tests. If anyone could help me get a quick start on that topic, I'd like to volunteer some time to get those patches into the module.
Comment #11
geek-merlinFound an olde issue which may or may not help.
Comment #12
socialnicheguru commentedNo longer applies to inline_entity_form 1.0.0-rc12
Comment #13
mrinalini9 commentedRerolled patch #5 for 8.x-1.x branch, please review it.
Comment #14
podarokneeds reroll
Comment #15
lowfidelityRerolled patch #5 for 2.0.x-dev branch and fixed some coding standard issues.
Comment #16
lowfidelityPatch applies successfully to
2.0.x-devand2.0@beta.Automated tests for patch #15 fail with
PHP 8.1 & MySQL 8, D9.5 run-tests.sh fatal errordue to an unrelated error:PHP Fatal error: Uncaught Error: Class "Drupal\inline_entity_form\Tests\InlineEntityFormTestBase" not found in /var/www/html/modules/contrib/inline_entity_form/src/Tests/ContentModerationTranslationTest.php:12See issue #2989028: https://www.drupal.org/project/inline_entity_form/issues/2989028#comment...
Comment #18
podarok#16 is in
tnx
Comment #20
geek-merlinBulk reopen. Tag says needs tests.