We should create a simpletest that tests the zone form, confirming that it's possible to add a zone, and add/remove zone members (via ajax).
The resulting entity should be compared with expected values, and the $zone->match() method used to ensure it works.

We can create a zone that has an EU zone member and a California zone member to test the EU and Country zone members at least.
Then create another zone that references that one (zone_member_zone) to check that as well.

Comments

bojanz created an issue. See original summary.

michfuer’s picture

Assigned: Unassigned » michfuer
vasike’s picture

Status: Active » Needs work

there is a first patch for this.
It doesn't include the member zone and its ajax stuff.
So more work needed on this

However working on this i noticed there is an warning on submit zone without zone members:
Warning: Invalid argument supplied for foreach() in Drupal\address\Form\ZoneForm->submitForm() (line 246 of /d8_path/modules/address/src/Form/ZoneForm.php).
The patch include a fix for this.

vasike’s picture

StatusFileSize
new5.8 KB

forgot the patch

vasike’s picture

Status: Needs work » Needs review
StatusFileSize
new6.49 KB

and here is a more complete patch
- Merge all the Zone entity (CRUD) operations to one test method
so now we have:
- Create zone from UI
- Edit the new zone from UI: change the name and add 2 members EU and California.
- Delete zone from UI.
that would be all.

vasike’s picture

StatusFileSize
new6.49 KB

small update: Convert camelCase to snake_case for a variable.

vasike’s picture

StatusFileSize
new9.38 KB

Update the patch:
- Separate the tests for create/edit/delete
- Add extra checks for the form elements existence.

  • bojanz committed 2d204a1 on 8.x-1.x authored by vasike
    Issue #2587013 by vasike, bojanz: Create a zone member test
    
bojanz’s picture

Status: Needs review » Fixed

Expanded, committed.

Status: Fixed » Closed (fixed)

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