3 namespace Drupal\Tests\taxonomy\Functional\Views;
5 use Drupal\views\Views;
8 * Tests the taxonomy term on node relationship handler.
12 class RelationshipNodeTermDataTest extends TaxonomyTestBase {
15 * Views used by this test.
19 public static $testViews = ['test_taxonomy_node_term_data'];
21 public function testViewsHandlerRelationshipNodeTermData() {
22 $view = Views::getView('test_taxonomy_node_term_data');
23 // Tests \Drupal\taxonomy\Plugin\views\relationship\NodeTermData::calculateDependencies().
25 'config' => ['core.entity_view_mode.node.teaser'],
32 $this->assertIdentical($expected, $view->getDependencies());
33 $this->executeView($view, [$this->term1->id(), $this->term2->id()]);
36 'nid' => $this->nodes[1]->id(),
39 'nid' => $this->nodes[0]->id(),
42 $column_map = ['nid' => 'nid'];
43 $this->assertIdenticalResultset($view, $expected_result, $column_map);
45 // Change the view to test relation limited by vocabulary.
46 $this->config('views.view.test_taxonomy_node_term_data')
47 ->set('display.default.display_options.relationships.term_node_tid.vids', ['views_testing_tags'])
50 $view = Views::getView('test_taxonomy_node_term_data');
51 // Tests \Drupal\taxonomy\Plugin\views\relationship\NodeTermData::calculateDependencies().
52 $expected['config'][] = 'taxonomy.vocabulary.views_testing_tags';
53 $this->assertIdentical($expected, $view->getDependencies());
54 $this->executeView($view, [$this->term1->id(), $this->term2->id()]);
55 $this->assertIdenticalResultset($view, $expected_result, $column_map);