diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
index ef6101a..9ef575f 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/filter/TaxonomyIndexTid.php
@@ -137,7 +137,7 @@ protected function valueForm(&$form, &$form_state) {
 
         if ($tree) {
           foreach ($tree as $term) {
-            $choice = new stdClass();
+            $choice = new \stdClass();
             $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
             $options[] = $choice;
           }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyIndexTidUiTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyIndexTidUiTest.php
new file mode 100644
index 0000000..1075d7b
--- /dev/null
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyIndexTidUiTest.php
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\taxonomy\Tests\Views\TaxonomyIndexTidUiTest.
+ */
+
+namespace Drupal\taxonomy\Tests\Views;
+
+use Drupal\views\Tests\ViewTestData;
+use Drupal\views_ui\Tests\UITestBase;
+
+/**
+ * Tests the taxonomy index filter handler UI.
+ *
+ * @see \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid
+ */
+class TaxonomyIndexTidUiTest extends UITestBase {
+
+  /**
+   * Views used by this test.
+   *
+   * @var array
+   */
+  public static $testViews = array('test_filter_taxonomy_index_tid');
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('node', 'taxonomy', 'taxonomy_test_views');
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Taxonomy: node index Filter (UI)',
+      'description' => 'Tests the taxonomy index filter handler UI.',
+      'group' => 'Views module integration',
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    ViewTestData::importTestViews(get_class($this), array('taxonomy_test_views'));
+  }
+
+  /**
+   * Tests the filter UI.
+   */
+  public function testFilterUI() {
+    entity_create('taxonomy_vocabulary', array(
+      'vid' => 'tags',
+      'name' => 'Tags',
+    ))->save();
+
+    $terms = array();
+    // Setup a hierarchy which looks like this:
+    // term 0.0
+    // term 1.0
+    // - term 1.1
+    // term 2.0
+    // - term 2.1
+    // - term 2.2
+    for ($i = 0; $i < 3; $i++) {
+      for ($j = 0; $j <= $i; $j++) {
+        $terms[$i][$j] = $term = entity_create('taxonomy_term', array(
+          'vid' => 'tags',
+          'name' => "Term $i.$j",
+          'parent' => isset($terms[$i][0]) ? $terms[$i][0]->id() : 0,
+        ));
+        $term->save();
+      }
+    }
+
+    $this->drupalGet('admin/structure/views/nojs/config-item/test_filter_taxonomy_index_tid/default/filter/tid');
+
+    $result = $this->xpath('//select[@id="edit-options-value"]/option');
+
+    // Ensure that the expected hierarchy is available in the UI.
+    $counter = 0;
+    for ($i = 0; $i < 3; $i++) {
+      for ($j = 0; $j <= $i; $j++) {
+        $option = $result[$counter++];
+        $prefix = $terms[$i][$j]->parent->value ? '-' : '';
+        $attributes = $option->attributes();
+        $tid = (string) $attributes->value;
+
+        $this->assertEqual($prefix . $terms[$i][$j]->label(), (string) $option);
+        $this->assertEqual($terms[$i][$j]->id(), $tid);
+      }
+    }
+  }
+
+}
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
new file mode 100644
index 0000000..d14ecff
--- /dev/null
+++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
@@ -0,0 +1,173 @@
+base_field: nid
+base_table: node
+core: 8.x
+description: ''
+status: '1'
+display:
+  default:
+    display_plugin: default
+    id: default
+    display_title: Master
+    position: '1'
+    display_options:
+      access:
+        type: perm
+        options:
+          perm: 'access content'
+      cache:
+        type: none
+        options: {  }
+      query:
+        type: views_query
+        options:
+          disable_sql_rewrite: '0'
+          distinct: '0'
+          slave: '0'
+          query_comment: ''
+          query_tags: {  }
+      exposed_form:
+        type: basic
+        options:
+          submit_button: Apply
+          reset_button: '0'
+          reset_button_label: Reset
+          exposed_sorts_label: 'Sort by'
+          expose_sort_order: '1'
+          sort_asc_label: Asc
+          sort_desc_label: Desc
+      pager:
+        type: full
+        options:
+          items_per_page: '10'
+          offset: '0'
+          id: '0'
+          total_pages: ''
+          expose:
+            items_per_page: '0'
+            items_per_page_label: 'Items per page'
+            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options_all: '0'
+            items_per_page_options_all_label: '- All -'
+            offset: '0'
+            offset_label: Offset
+          tags:
+            previous: '‹ previous'
+            next: 'next ›'
+            first: '« first'
+            last: 'last »'
+          quantity: '9'
+      style:
+        type: default
+        options:
+          grouping: {  }
+          row_class: ''
+          default_row_class: '1'
+          row_class_special: '1'
+          uses_fields: '0'
+      row:
+        type: fields
+        options:
+          inline: {  }
+          separator: ''
+          hide_empty: '0'
+          default_field_elements: '1'
+      fields:
+        title:
+          id: title
+          table: node_field_data
+          field: title
+          provider: node
+          label: ''
+          alter:
+            alter_text: '0'
+            make_link: '0'
+            absolute: '0'
+            trim: '0'
+            word_boundary: '0'
+            ellipsis: '0'
+            strip_tags: '0'
+            html: '0'
+          hide_empty: '0'
+          empty_zero: '0'
+          link_to_node: '1'
+          relationship: none
+          group_type: group
+          admin_label: ''
+          exclude: '0'
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: '1'
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: '1'
+          empty: ''
+          hide_alter_empty: '1'
+      filters:
+        status:
+          value: '1'
+          table: node_field_data
+          field: status
+          provider: node
+          id: status
+          expose:
+            operator: '0'
+          group: '1'
+        tid:
+          id: tid
+          table: taxonomy_index
+          field: tid
+          relationship: none
+          group_type: group
+          admin_label: ''
+          operator: or
+          value:
+            2: '2'
+          group: '1'
+          exposed: '0'
+          expose:
+            operator_id: '0'
+            label: ''
+            description: ''
+            use_operator: '0'
+            operator: ''
+            identifier: ''
+            required: '0'
+            remember: '0'
+            multiple: '0'
+            remember_roles:
+              authenticated: authenticated
+            reduce: '0'
+          is_grouped: '0'
+          group_info:
+            label: ''
+            description: ''
+            identifier: ''
+            optional: '1'
+            widget: select
+            multiple: '0'
+            remember: '0'
+            default_group: All
+            default_group_multiple: {  }
+            group_items: {  }
+          reduce_duplicates: '0'
+          type: select
+          limit: '1'
+          vid: tags
+          hierarchy: '1'
+          error_message: '1'
+          plugin_id: taxonomy_index_tid
+          provider: taxonomy
+      sorts: {  }
+      header: {  }
+      footer: {  }
+      empty: {  }
+      relationships: {  }
+      arguments: {  }
+label: test_filter_taxonomy_index_tid
+module: views
+id: test_filter_taxonomy_index_tid
+tag: ''
+uuid: b8bb8999-3e2c-4170-9500-ebafe26e5a78
+langcode: en
