function TermContextualLinksTest::testTermContextualLinks

Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/TermContextualLinksTest.php \Drupal\Tests\taxonomy\Functional\TermContextualLinksTest::testTermContextualLinks()
  2. 10 core/modules/taxonomy/tests/src/Functional/TermContextualLinksTest.php \Drupal\Tests\taxonomy\Functional\TermContextualLinksTest::testTermContextualLinks()
  3. 11.x core/modules/taxonomy/tests/src/Functional/TermContextualLinksTest.php \Drupal\Tests\taxonomy\Functional\TermContextualLinksTest::testTermContextualLinks()

Tests contextual links.

File

core/modules/taxonomy/tests/src/Functional/TermContextualLinksTest.php, line 27

Class

TermContextualLinksTest
Tests views contextual links on terms.

Namespace

Drupal\Tests\taxonomy\Functional

Code

public function testTermContextualLinks() {
    $vocabulary = $this->createVocabulary();
    $term = $this->createTerm($vocabulary);
    $user = $this->drupalCreateUser([
        'administer taxonomy',
        'access contextual links',
    ]);
    $this->drupalLogin($user);
    $this->drupalGet('taxonomy/term/' . $term->id());
    $this->assertSession()
        ->elementAttributeContains('css', 'div[data-contextual-id]', 'data-contextual-id', 'taxonomy_term:taxonomy_term=' . $term->id() . ':');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.