diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php
index 5fcb017..19fa21c 100644
--- a/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/UI/HandlerTest.php
@@ -21,7 +21,7 @@ class HandlerTest extends UITestBase {
    *
    * @var array
    */
-  public static $testViews = array('test_view');
+  public static $testViews = array('test_view_empty');
 
   public static function getInfo() {
     return array(
@@ -32,38 +32,115 @@ public static function getInfo() {
   }
 
   /**
+   * Overrides \Drupal\views\Tests\ViewTestBase::schemaDefinition().
+   *
+   * Adds a uid column to test the relationships.
+   */
+  protected function schemaDefinition() {
+    $schema = parent::schemaDefinition();
+
+    $schema['views_test_data']['fields']['uid'] = array(
+      'description' => "The {users}.uid of the author of the beatle entry.",
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0
+    );
+
+    return $schema;
+  }
+
+  /**
+   * Overrides \Drupal\views\Tests\ViewTestBase::viewsData().
+   *
+   * Adds a relationship for the uid column.
+   */
+  protected function viewsData() {
+    $data = parent::viewsData();
+    $data['views_test_data']['uid'] = array(
+      'title' => t('UID'),
+      'help' => t('The test data UID'),
+      'relationship' => array(
+        'id' => 'standard',
+        'base' => 'users',
+        'base field' => 'uid'
+      )
+    );
+
+    return $data;
+  }
+
+  /**
    * Tests UI CRUD.
    */
   public function testUICRUD() {
     $handler_types = ViewExecutable::viewsHandlerTypes();
     foreach ($handler_types as $type => $type_info) {
       // Test adding handlers.
-      $add_handler_url = "admin/structure/views/nojs/add-item/test_view/default/$type";
+      $add_handler_url = "admin/structure/views/nojs/add-item/test_view_empty/default/$type";
 
       // Area handler types need to use a different handler.
       if (in_array($type, array('header', 'footer', 'empty'))) {
         $this->drupalPost($add_handler_url, array('name[views.area]' => TRUE), t('Add and configure @handler', array('@handler' => $type_info['ltitle'])));
-        $edit_handler_url = "admin/structure/views/nojs/config-item/test_view/default/$type/area";
+        $id = 'area';
+        $edit_handler_url = "admin/structure/views/nojs/config-item/test_view_empty/default/$type/$id";
       }
       elseif ($type == 'relationship') {
-        // @todo Add a views_test_data relationship handler to test.
-        continue;
+        $this->drupalPost($add_handler_url, array('name[views_test_data.uid]' => TRUE), t('Add and configure @handler', array('@handler' => $type_info['ltitle'])));
+        $id = 'uid';
+        $edit_handler_url = "admin/structure/views/nojs/config-item/test_view_empty/default/$type/$id";
       }
       else {
         $this->drupalPost($add_handler_url, array('name[views_test_data.job]' => TRUE), t('Add and configure @handler', array('@handler' => $type_info['ltitle'])));
-        $edit_handler_url = "admin/structure/views/nojs/config-item/test_view/default/$type/job";
+        $id = 'job';
+        $edit_handler_url = "admin/structure/views/nojs/config-item/test_view_empty/default/$type/$id";
       }
 
       $this->assertUrl($edit_handler_url, array(), 'The user got redirected to the handler edit form.');
       $this->drupalPost(NULL, array(), t('Apply'));
 
-      $this->assertUrl('admin/structure/views/view/test_view/edit', array(), 'The user got redirected to the views edit form.');
+      $this->assertUrl('admin/structure/views/view/test_view_empty/edit', array(), 'The user got redirected to the views edit form.');
 
       $this->assertLinkByHref($edit_handler_url, 0, 'The handler edit link appears in the UI.');
 
+      // Save the view and have a look whether the handler was added as expected.
+      $this->drupalPost(NULL, array(), t('Save'));
+      $views = $this->container->get('plugin.manager.entity')->getStorageController('view')->load(array('test_view_empty'));
+      $view = reset($views);
+      $display = $view->getDisplay('default');
+      $this->assertTrue(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was added to the view itself.');
+
+      // Remove the item and check that it's removed
       $this->drupalPost($edit_handler_url, array(), t('Remove'));
       $this->assertNoLinkByHref($edit_handler_url, 0, 'The handler edit link does not appears in the UI after removing.');
+
+      $this->drupalPost(NULL, array(), t('Save'));
+      $views = $this->container->get('plugin.manager.entity')->getStorageController('view')->load(array('test_view_empty'));
+      $view = reset($views);
+      $display = $view->getDisplay('default');
+      $this->assertFalse(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was removed from the view itself.');
     }
+
+    // Test adding a field of the user table using the uid relationship.
+    $type_info = $handler_types['relationship'];
+    $add_handler_url = "admin/structure/views/nojs/add-item/test_view_empty/default/relationship";
+    $this->drupalPost($add_handler_url, array('name[views_test_data.uid]' => TRUE), t('Add and configure @handler', array('@handler' => $type_info['ltitle'])));
+
+    $add_handler_url = "admin/structure/views/nojs/add-item/test_view_empty/default/field";
+    $type_info = $handler_types['field'];
+    $this->drupalPost($add_handler_url, array('name[users.signature]' => TRUE), t('Add and configure @handler', array('@handler' => $type_info['ltitle'])));
+    $id = 'signature';
+    $edit_handler_url = "admin/structure/views/nojs/config-item/test_view_empty/default/field/$id";
+
+    $this->assertUrl($edit_handler_url, array(), 'The user got redirected to the handler edit form.');
+    $this->assertFieldByName('options[relationship]', 'uid', 'Ensure the relationship select is filled with the UID relationship.');
+    $this->drupalPost(NULL, array(), t('Apply'));
+
+    $this->drupalPost(NULL, array(), t('Save'));
+    $views = $this->container->get('plugin.manager.entity')->getStorageController('view')->load(array('test_view_empty'));
+    $view = reset($views);
+    $display = $view->getDisplay('default');
+    $this->assertTrue(isset($display['display_options'][$type_info['plural']][$id]), 'Ensure the field was added to the view itself.');
   }
 
 }
diff --git a/core/modules/views/tests/views_test_config/test_views/views.view.test_view_empty.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_empty.yml
new file mode 100644
index 0000000..bfa9eb4
--- /dev/null
+++ b/core/modules/views/tests/views_test_config/test_views/views.view.test_view_empty.yml
@@ -0,0 +1,31 @@
+base_table: views_test_data
+core: '8'
+description: ''
+disabled: '0'
+display:
+  default:
+    display_options:
+      defaults:
+        fields: '0'
+        pager: '0'
+        pager_options: '0'
+        sorts: '0'
+      fields:
+        id:
+          field: id
+          id: id
+          relationship: none
+          table: views_test_data
+          plugin_id: numeric
+      pager:
+        options:
+          offset: '0'
+        type: none
+      pager_options: {  }
+    display_plugin: default
+    display_title: Master
+    id: default
+    position: '0'
+human_name: ''
+id: test_view_empty
+tag: ''
diff --git a/core/modules/views/views_ui/admin.inc b/core/modules/views/views_ui/admin.inc
index 9e9f1ba..28f738f 100644
--- a/core/modules/views/views_ui/admin.inc
+++ b/core/modules/views/views_ui/admin.inc
@@ -1405,6 +1405,7 @@ function views_ui_config_item_form($form, &$form_state) {
     ),
   );
   $executable = $view->get('executable');
+  $save_ui_cache = FALSE;
   if (!$executable->setDisplay($display_id)) {
     views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
   }
@@ -1466,7 +1467,7 @@ function views_ui_config_item_form($form, &$form_state) {
           // We want this relationship option to get saved even if the user
           // skips submitting the form.
           $executable->setItemOption($display_id, $type, $id, 'relationship', $rel);
-          views_ui_cache_set($view);
+          $save_ui_cache = TRUE;
         }
 
         $form['options']['relationship'] = array(
@@ -1513,6 +1514,10 @@ function views_ui_config_item_form($form, &$form_state) {
     $form['buttons']['remove']['#limit_validation_errors'] = array(array('override'));
   }
 
+  if ($save_ui_cache) {
+    views_ui_cache_set($view);
+  }
+
   return $form;
 }
 
