0d4aabe6a089077be0103b5681be1b44d4d106e7
[yaffs-website] / web / core / modules / node / tests / src / Functional / NodeContextualLinksTest.php
1 <?php
2
3 namespace Drupal\Tests\node\Functional;
4
5 use Drupal\node\Entity\Node;
6
7 /**
8  * Tests views contextual links on nodes.
9  *
10  * @group node
11  */
12 class NodeContextualLinksTest extends NodeTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = [
18     'contextual',
19   ];
20
21   /**
22    * Tests contextual links.
23    */
24   public function testNodeContextualLinks() {
25     // Create a node item.
26     $node = Node::create([
27       'type' => 'article',
28       'title' => 'Unnamed',
29     ]);
30     $node->save();
31
32     $user = $this->drupalCreateUser([
33       'administer nodes',
34       'access contextual links',
35     ]);
36     $this->drupalLogin($user);
37
38     $this->drupalGet('node/' . $node->id());
39     $this->assertSession()->elementAttributeContains('css', 'div[data-contextual-id]', 'data-contextual-id', 'node:node=' . $node->id() . ':');
40   }
41
42 }