NodeContextualLinksTest.php in Drupal 9
File
core/modules/node/tests/src/Functional/NodeContextualLinksTest.php
View source
<?php
namespace Drupal\Tests\node\Functional;
use Drupal\node\Entity\Node;
class NodeContextualLinksTest extends NodeTestBase {
protected static $modules = [
'contextual',
];
protected $defaultTheme = 'stark';
public function testNodeContextualLinks() {
$node = Node::create([
'type' => 'article',
'title' => 'Unnamed',
]);
$node
->save();
$user = $this
->drupalCreateUser([
'administer nodes',
'access contextual links',
]);
$this
->drupalLogin($user);
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->elementAttributeContains('css', 'div[data-contextual-id]', 'data-contextual-id', 'node:node=' . $node
->id() . ':');
}
}