diff --git a/src/Form/ZoneForm.php b/src/Form/ZoneForm.php
index a445bb0..8af3567 100644
--- a/src/Form/ZoneForm.php
+++ b/src/Form/ZoneForm.php
@@ -245,20 +245,23 @@ class ZoneForm extends EntityForm {
   public function submitForm(array &$form, FormStateInterface $form_state) {
     parent::submitForm($form, $form_state);
 
-    foreach ($form_state->getValue(['members']) as $member_index => $values) {
-      $member_form = $form['members'][$member_index]['form'];
-      /** @var \Drupal\address\Plugin\ZoneMember\ZoneMemberInterface $member */
-      $member = $member_form['#member'];
-      $member_form_state = $this->buildMemberFormState($member_form['#parents'], $form_state);
-      $member->submitConfigurationForm($member_form, $member_form_state);
-      // Update form state with values that might have been changed by the plugin.
-      $form_state->setValue($member_form['#parents'], $member_form_state->getValues());
-      // Update the member weight.
-      $configuration = $member->getConfiguration();
-      $configuration['weight'] = $values['weight'];
-      $member->setConfiguration($configuration);
-      // Update the member on the entity.
-      $this->entity->getMembers()->addInstanceId($member->getId(), $configuration);
+    if (!empty($form_state->getValue(['members']))) {
+      foreach ($form_state->getValue(['members']) as $member_index => $values) {
+        $member_form = $form['members'][$member_index]['form'];
+        /** @var \Drupal\address\Plugin\ZoneMember\ZoneMemberInterface $member */
+        $member = $member_form['#member'];
+        $member_form_state = $this->buildMemberFormState($member_form['#parents'], $form_state);
+        $member->submitConfigurationForm($member_form, $member_form_state);
+        // Update form state with values that might have been changed by the plugin.
+        $form_state->setValue($member_form['#parents'], $member_form_state->getValues());
+        // Update the member weight.
+        $configuration = $member->getConfiguration();
+        $configuration['weight'] = $values['weight'];
+        $member->setConfiguration($configuration);
+        // Update the member on the entity.
+        $this->entity->getMembers()
+          ->addInstanceId($member->getId(), $configuration);
+      }
     }
   }
 
diff --git a/src/Tests/ZoneTest.php b/src/Tests/ZoneTest.php
new file mode 100644
index 0000000..b5ab311
--- /dev/null
+++ b/src/Tests/ZoneTest.php
@@ -0,0 +1,216 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\address\Tests\ZoneTest.
+ */
+
+namespace Drupal\address\Tests;
+
+use CommerceGuys\Addressing\Model\Address;
+use Drupal\address\Entity\Zone;
+use Drupal\Component\Render\FormattableMarkup;
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests the zone entity and UI.
+ *
+ * @group address
+ */
+class ZoneTest extends WebTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = [
+    'address',
+    'block',
+    'system',
+    'user',
+
+  ];
+
+  /**
+   * A test user with administrative privileges.
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $adminUser;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $this->drupalPlaceBlock('local_tasks_block');
+    $this->drupalPlaceBlock('local_actions_block');
+    $this->drupalPlaceBlock('page_title_block');
+
+    $this->adminUser = $this->drupalCreateUser([
+      'administer zones',
+      'access administration pages',
+      'administer site configuration',
+    ]);
+    $this->drupalLogin($this->adminUser);
+  }
+
+  /**
+   * Tests creating a zone via UI.
+   */
+  function testCreateZone() {
+    // Create a zone via UI.
+    $this->drupalGet('admin/config/regional/zones');
+    $this->clickLink('Add a new zone');
+
+    // Check the integrity of the form.
+    $this->assertFieldByName('id', NULL, 'Id field is present.');
+    $this->assertFieldByName('name', NULL, 'Name field is present.');
+    $this->assertFieldByName('scope', NULL, 'Scope field is present.');
+    $this->assertFieldByName('plugin', NULL, 'Zone member plugin field is present.');
+    $this->assertFieldsByValue(t('Add'), NULL, 'Add zone member button is present.');
+    $this->assertFieldsByValue(t('Save'), NULL, 'Save button is present.');
+
+    // Build the data for the zone.
+    $edit = [
+      'id' => 'test_zone',
+      'name' => $this->randomMachineName(),
+      'scope' => $this->randomMachineName(6),
+    ];
+
+    // Test zone members.
+    // Add a EU zone member.
+    $zone_member_values = [
+      'plugin' => 'eu',
+    ];
+    $this->drupalPostForm(NULL, $zone_member_values, t('Add'));
+
+    // Check the integrity of the zone member form.
+    $this->assertFieldByName('members[0][form][name]', NULL, 'Name for the zone member field is present.');
+    $this->assertFieldByName('remove_member0', NULL, 'Remove button for the zone member field is present.');
+
+    // Add US California zone member.
+    $zone_member_values = [
+      'plugin' => 'country',
+    ];
+    $this->drupalPostForm(NULL, $zone_member_values, t('Add'));
+
+    // Check the integrity of the country zone member form.
+    $this->assertFieldByName('members[1][form][country_code]', NULL, 'Country for the zone member field is present.');
+
+    // Set the US for the country code with Ajax.
+    $country_values = [
+      'members[1][form][country_code]' => 'US',
+    ];
+    $this->drupalPostAjaxForm(NULL, $country_values, 'members[1][form][country_code]');
+
+    // Check the integrity of the country zone member form.
+    $this->assertFieldByName('members[1][form][administrative_area]', NULL, 'State for the zone member field is present.');
+    $this->assertFieldByName('members[1][form][included_postal_codes]', NULL, 'Included postal codes for the zone member field is present.');
+    $this->assertFieldByName('members[1][form][excluded_postal_codes]', NULL, 'Excluded postal codes for the zone member field is present.');
+
+    // Set California values for name and administrative area.
+    $edit += [
+      'members[1][form][name]' => 'California zone member',
+      'members[1][form][administrative_area]' => 'US-CA',
+    ];
+    // Save the editing zone.
+    $this->drupalPostForm(NULL, $edit, t('Save'));
+
+    // Check the results.
+    $zone = Zone::load($edit['id']);
+    $this->assertEqual($zone->getName(), $edit['name'], 'The zone name has been successfully saved.');
+
+    // Check an EU address.
+    $eu_address = new Address('FR');
+    $this->assertTrue($zone->match($eu_address), 'The EU zone member successfully set.');
+
+    // Check an US California address.
+    $us_ca_address = new Address();
+    $us_ca_address = $us_ca_address
+      ->withCountryCode('US')
+      ->withAdministrativeArea('US-CA')
+      ->withLocality('Mountain View')
+      ->withAddressLine1('1098 Alta Ave');
+    $this->assertTrue($zone->match($us_ca_address), 'The California zone member successfully set.');
+  }
+
+  /**
+   * Tests editing a zone via UI.
+   */
+  function testEditZone() {
+    // Create a zone.
+    $zone = $this->createZone([
+      'id' => 'zone_id',
+      'name' => $this->randomMachineName(),
+      'scope' => $this->randomMachineName(6),
+    ]);
+
+    // Test editing zone from UI.
+    $this->drupalGet('admin/config/regional/zones');
+    $this->clickLink(t('Edit'));
+
+    // Only change the name.
+    $edit = [
+      'name' => $this->randomMachineName(),
+    ];
+    // Save the editing zone.
+    $this->drupalPostForm(NULL, $edit, t('Save'));
+
+    // Check the results.
+    \Drupal::service('entity_type.manager')->getStorage('zone')->resetCache([$zone->id()]);
+    $zone = Zone::load($zone->id());
+    $this->assertEqual($zone->getName(), $edit['name'], 'The zone name has been successfully changed.');
+  }
+
+  /**
+   * Tests deleting a zone via UI.
+   */
+  function testDeleteZone() {
+    // Create a zone.
+    $zone = $this->createZone([
+      'id' => $this->randomMachineName(6),
+      'name' => $this->randomMachineName(),
+      'scope' => $this->randomMachineName(6),
+    ]);
+
+    // Delete the zone from UI.
+    $this->drupalGet('admin/config/regional/zones/manage/' . $zone->id() . '/delete');
+    $this->assertResponse(200, 'The zone delete form can be accessed.');
+    $this->assertText(t('This action cannot be undone.'), 'The zone delete confirmation form is available.');
+    $this->drupalPostForm(NULL, NULL, t('Delete'));
+
+    \Drupal::service('entity_type.manager')->getStorage('zone')->resetCache([$zone->id()]);
+    $zone_exists = (bool) Zone::load($zone->id());
+    $this->assertFalse($zone_exists, 'The zone has been deleted form the database.');
+  }
+
+  /**
+   * Creates a new zone entity.
+   *
+   * @param array $values
+   *   An array of settings.
+   *   Example: 'id' => 'foo'.
+   *
+   * @return \Drupal\Core\Entity\EntityInterface
+   *   A new zone entity.
+   */
+  protected function createZone(array $values) {
+    /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
+    $storage = \Drupal::service('entity_type.manager')->getStorage('zone');
+    $zone = $storage->create($values);
+    $status = $zone->save();
+    $this->assertEqual($status, SAVED_NEW, new FormattableMarkup('Created %label entity %type.', [
+      '%label' => $zone->getEntityType()->getLabel(),
+      '%type' => $zone->id()
+    ]));
+    // The newly saved entity isn't identical to a loaded one, and would fail
+    // comparisons.
+    $zone = $storage->load($zone->id());
+
+    return $zone;
+  }
+
+}
