You are here

public function NodeLinksTest::testHideLinks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/NodeLinksTest.php \Drupal\node\Tests\NodeLinksTest::testHideLinks()

Tests that the links can be hidden in the view display settings.

File

core/modules/node/src/Tests/NodeLinksTest.php, line 26
Contains \Drupal\node\Tests\NodeLinksTest.

Class

NodeLinksTest
Tests the output of node links (read more, add new comment, etc).

Namespace

Drupal\node\Tests

Code

public function testHideLinks() {
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'article',
    'promote' => NODE_PROMOTED,
  ));

  // Links are displayed by default.
  $this
    ->drupalGet('node');
  $this
    ->assertText($node
    ->getTitle());
  $this
    ->assertLink('Read more');

  // Hide links.
  entity_get_display('node', 'article', 'teaser')
    ->removeComponent('links')
    ->save();
  $this
    ->drupalGet('node');
  $this
    ->assertText($node
    ->getTitle());
  $this
    ->assertNoLink('Read more');
}