1<?php
2
3namespace Drupal\Tests\taxonomy\Functional;
4
5/**
6 * Tests views contextual links on terms.
7 *
8 * @group taxonomy
9 */
10class TermContextualLinksTest extends TaxonomyTestBase {
11
12  /**
13   * {@inheritdoc}
14   */
15  protected static $modules = [
16    'contextual',
17  ];
18
19  /**
20   * {@inheritdoc}
21   */
22  protected $defaultTheme = 'stark';
23
24  /**
25   * Tests contextual links.
26   */
27  public function testTermContextualLinks() {
28    $vocabulary = $this->createVocabulary();
29    $term = $this->createTerm($vocabulary);
30
31    $user = $this->drupalCreateUser([
32      'administer taxonomy',
33      'access contextual links',
34    ]);
35    $this->drupalLogin($user);
36
37    $this->drupalGet('taxonomy/term/' . $term->id());
38    $this->assertSession()->elementAttributeContains('css', 'div[data-contextual-id]', 'data-contextual-id', 'taxonomy_term:taxonomy_term=' . $term->id() . ':');
39  }
40
41}
42