class NodeContextualLinksTest in Drupal 10
Same name in this branch
- 10 core/modules/node/tests/src/Functional/NodeContextualLinksTest.php \Drupal\Tests\node\Functional\NodeContextualLinksTest
- 10 core/modules/node/tests/src/Functional/Views/NodeContextualLinksTest.php \Drupal\Tests\node\Functional\Views\NodeContextualLinksTest
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Functional/NodeContextualLinksTest.php \Drupal\Tests\node\Functional\NodeContextualLinksTest
- 9 core/modules/node/tests/src/Functional/NodeContextualLinksTest.php \Drupal\Tests\node\Functional\NodeContextualLinksTest
Tests views contextual links on nodes.
@group node
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\node\Functional\NodeTestBase
- class \Drupal\Tests\node\Functional\NodeContextualLinksTest
- class \Drupal\Tests\node\Functional\NodeTestBase
Expanded class hierarchy of NodeContextualLinksTest
File
- core/
modules/ node/ tests/ src/ Functional/ NodeContextualLinksTest.php, line 12
Namespace
Drupal\Tests\node\FunctionalView source
class NodeContextualLinksTest extends NodeTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'contextual',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests contextual links.
*/
public function testNodeContextualLinks() {
// Create a node item.
$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() . ':');
}
}