Inline Entity Form has become very popular, but this success comes at a price: since so many websites rely on its correct functionality it has become difficult to provide new functionality, fix bugs or refactor code since everything has to be tested manually. We could really use a basic set of tests to help us with this.

Some work has been done in #2134035: Allow to add existing entities using the single value field widget to provide test coverage for that issue. We could refactor the asserts from that patch into a separate base class and start from there.

Comments

strykaizer’s picture

Status: Active » Needs review
StatusFileSize
new48.13 KB

Attached you can find the "Complex widget" tests from D8 ported to d7.

Porting this tests exposed one issue in d7, which I still need to look in to, (checking the "delete referenced entity" checkbox on deleting a reference, did not delete the entity, could be both a real issue or a test ported wrong)

Status: Needs review » Needs work

The last submitted patch, 1: add_basic_test_coverage-2463649-1.patch, failed testing.

strykaizer’s picture

Status: Needs work » Needs review
StatusFileSize
new48.13 KB

One short array less now...

Status: Needs review » Needs work

The last submitted patch, 3: add_basic_test_coverage-2463649-3.patch, failed testing.

strykaizer’s picture

Status: Needs work » Needs review
StatusFileSize
new48.14 KB

Lets see if this is more 5.3 compatible now...

Status: Needs review » Needs work

The last submitted patch, 5: add_basic_test_coverage-2463649-5.patch, failed testing.

strykaizer’s picture

Status: Needs work » Needs review
StatusFileSize
new48.4 KB

Added entityreference as test dependency

Status: Needs review » Needs work

The last submitted patch, 7: add_basic_test_coverage-2463649-7.patch, failed testing.

strykaizer’s picture

Status: Needs work » Needs review
StatusFileSize
new48.43 KB

ctools also added as testdependency, almost running out of ideas

Status: Needs review » Needs work

The last submitted patch, 9: add_basic_test_coverage-2463649-9.patch, failed testing.

The last submitted patch, 9: add_basic_test_coverage-2463649-9.patch, failed testing.

strykaizer’s picture

[23:40:44] StryKaizer > Writing tests for inline entity form. They work on my machine (5.3 and 5.6) but fail on d.o.. The custom ief_test module is not getting enabled in the setup. Anyone any suggestions on what I can do to fix this? Already added 2 test_dependencies (entityreference and ctools) which are needed for the ief_test module but no dice
[23:42:13] berdir > StryKaizer: new dependencies do not work immediately. you need to get them committed and give d.o some time to parse that and update its info about the project
[23:42:25] StryKaizer > berdir oh, great, thanks!
[23:42:28] berdir > StryKaizer: so you need to make a patch with just the dependencies and get that committed first

Guessing this is the issue why the above tests fail...

The expected output of the tests is 1 fail, being:
- The inline entity was deleted from the site. Other multiple_values_widget.test 357 MultipleValuesWidgetTest->testEntityEditingAndRemoving()

bojanz’s picture

The tests still refer to the "Complex" widget which is called "Multiple" in D7, let's update those references, and then I can commit this.

strykaizer’s picture

Status: Needs work » Needs review
StatusFileSize
new48.47 KB
new11.36 KB

Renamed to Multiple

Status: Needs review » Needs work

The last submitted patch, 14: add_basic_test_coverage-2463649-14.patch, failed testing.

strykaizer’s picture

Status: Needs work » Needs review
StatusFileSize
new47.93 KB
new3.61 KB

I looked into the issue where referencing nodes did not get deleted, and it looks like it's a d7 ajax test issue (could not reproduce it manually).

Changed this part to use non-ajax posts in the tests, should be all green now, once the test-dependencies are committed.

Status: Needs review » Needs work

The last submitted patch, 16: add_basic_test_coverage-2463649-16.patch, failed testing.

  • bojanz committed 0372fbd on 7.x-1.x authored by StryKaizer
    Issue #2463649 by StryKaizer, bojanz: Add basic test coverage
    
bojanz’s picture

Status: Needs work » Fixed

Committed, thanks!

bojanz’s picture

The tests are now running: https://www.drupal.org/pift-ci-job/249781 though it seems that the nested ones are failing. We need to figure out why.

EDIT: Nevermind, passing now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.