From 4b6ba9f079352e26d992acc2353425736fc24560 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Sun, 6 Apr 2014 21:46:19 +0100
Subject: [PATCH] Issue #2207229 by larowlan, jibran: Attempt to use 'Parent
 Term' relationship results in broken/missing handler.

---
 .../Tests/Views/TaxonomyParentUITest.php      |  62 ++++++++
 core/modules/taxonomy/taxonomy.views.inc      |   1 +
 .../views.view.test_taxonomy_parent.yml       | 140 ++++++++++++++++++
 3 files changed, 203 insertions(+)
 create mode 100644 core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyParentUITest.php
 create mode 100644 core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_parent.yml

diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyParentUITest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyParentUITest.php
new file mode 100644
index 000000000000..3a0fe1441507
--- /dev/null
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyParentUITest.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\taxonomy\Tests\Views\TaxonomyParentUITest.
+ */
+
+namespace Drupal\taxonomy\Tests\Views;
+
+use Drupal\views\Tests\ViewTestData;
+use Drupal\views_ui\Tests\UITestBase;
+
+/**
+ * Tests views role access plugin UI.
+ *
+ * @see Drupal\taxonomy\Plugin\views\access\Role
+ */
+class TaxonomyParentUITest extends UITestBase {
+
+  /**
+   * Views used by this test.
+   *
+   * @var array
+   */
+  public static $testViews = array('test_taxonomy_parent');
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('taxonomy', 'taxonomy_test_views');
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'Taxonomy: Term parent (UI)',
+      'description' => 'Tests views taxonomy parent plugin UI.',
+      'group' => 'Views module integration',
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    ViewTestData::createTestViews(get_class($this), array('taxonomy_test_views'));
+  }
+
+  /**
+   * Tests the taxonomy parent plugin UI.
+   */
+  public function testTaxonomyParentUI() {
+    $this->drupalGet('admin/structure/views/nojs/handler/test_taxonomy_parent/default/relationship/parent');
+    $this->assertNoText('The handler for this item is broken or missing.');
+  }
+
+}
diff --git a/core/modules/taxonomy/taxonomy.views.inc b/core/modules/taxonomy/taxonomy.views.inc
index 59b94ffd6ec1..2dfa5b22be02 100644
--- a/core/modules/taxonomy/taxonomy.views.inc
+++ b/core/modules/taxonomy/taxonomy.views.inc
@@ -338,6 +338,7 @@ function taxonomy_views_data() {
       'base' => 'taxonomy_term_data',
       'field' => 'parent',
       'label' => t('Parent'),
+      'id' => 'standard',
     ),
     'filter' => array(
       'help' => t('Filter the results of "Taxonomy: Term" by the parent pid.'),
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_parent.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_parent.yml
new file mode 100644
index 000000000000..23594d9486bf
--- /dev/null
+++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_parent.yml
@@ -0,0 +1,140 @@
+base_field: tid
+base_table: taxonomy_term_data
+core: 8.x
+description: ''
+status: true
+display:
+  default:
+    display_plugin: default
+    id: default
+    display_title: Master
+    position: 0
+    provider: views
+    display_options:
+      access:
+        type: perm
+        options:
+          perm: 'access content'
+        provider: user
+      cache:
+        type: none
+        options: {  }
+        provider: views
+      query:
+        type: views_query
+        options:
+          disable_sql_rewrite: false
+          distinct: false
+          slave: false
+          query_comment: false
+          query_tags: {  }
+        provider: views
+      exposed_form:
+        type: basic
+        options:
+          submit_button: Apply
+          reset_button: false
+          reset_button_label: Reset
+          exposed_sorts_label: 'Sort by'
+          expose_sort_order: true
+          sort_asc_label: Asc
+          sort_desc_label: Desc
+        provider: views
+      pager:
+        type: full
+        options:
+          items_per_page: 10
+          offset: 0
+          id: 0
+          total_pages: null
+          expose:
+            items_per_page: false
+            items_per_page_label: 'Items per page'
+            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options_all: false
+            items_per_page_options_all_label: '- All -'
+            offset: false
+            offset_label: Offset
+          tags:
+            previous: '‹ previous'
+            next: 'next ›'
+            first: '« first'
+            last: 'last »'
+          quantity: 9
+        provider: views
+      style:
+        type: default
+        options:
+          grouping: {  }
+          row_class: ''
+          default_row_class: true
+          row_class_special: true
+          uses_fields: false
+        provider: views
+      row:
+        type: fields
+        options:
+          inline: {  }
+          separator: ''
+          hide_empty: false
+          default_field_elements: true
+        provider: views
+      fields:
+        name:
+          id: name
+          table: taxonomy_term_data
+          field: name
+          provider: taxonomy
+          label: ''
+          alter:
+            alter_text: false
+            make_link: false
+            absolute: false
+            trim: false
+            word_boundary: false
+            ellipsis: false
+            strip_tags: false
+            html: false
+          hide_empty: false
+          empty_zero: false
+          link_to_taxonomy: 1
+          relationship: none
+          group_type: group
+          admin_label: ''
+          exclude: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_alter_empty: true
+          convert_spaces: false
+      filters: {  }
+      sorts: {  }
+      header: {  }
+      footer: {  }
+      empty: {  }
+      relationships:
+        parent:
+          id: parent
+          table: taxonomy_term_hierarchy
+          field: parent
+          relationship: none
+          group_type: group
+          admin_label: Parent
+          required: true
+          plugin_id: standard
+          provider: views
+      arguments: {  }
+label: test_taxonomy_parent
+module: views
+id: test_taxonomy_parent
+tag: ''
+langcode: en
+dependencies:
+  module:
+    - taxonomy
-- 
GitLab