function BlockContentContextualLinksTest::testBlockContentContextualLinks

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

Tests contextual links.

File

core/modules/block_content/tests/src/Functional/BlockContentContextualLinksTest.php, line 27

Class

BlockContentContextualLinksTest
Tests views contextual links on block content.

Namespace

Drupal\Tests\block_content\Functional

Code

public function testBlockContentContextualLinks() {
    $block_content = $this->createBlockContent();
    $block = $this->placeBlock('block_content:' . $block_content->uuid());
    $user = $this->drupalCreateUser([
        'administer blocks',
        'access contextual links',
    ]);
    $this->drupalLogin($user);
    $this->drupalGet('<front>');
    $this->assertSession()
        ->elementAttributeContains('css', 'div[data-contextual-id]', 'data-contextual-id', 'block:block=' . $block->id() . ':langcode=en|block_content:block_content=' . $block_content->id() . ':');
}

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