NodeLinksTest.php in Drupal 8
File
core/modules/node/tests/src/Functional/NodeLinksTest.php
View source
<?php
namespace Drupal\Tests\node\Functional;
use Drupal\node\NodeInterface;
class NodeLinksTest extends NodeTestBase {
public static $modules = [
'views',
];
protected $defaultTheme = 'stark';
public function testHideLinks() {
$node = $this
->drupalCreateNode([
'type' => 'article',
'promote' => NodeInterface::PROMOTED,
]);
$this
->drupalGet('node');
$this
->assertText($node
->getTitle());
$this
->assertSession()
->linkExists('Read more');
\Drupal::service('entity_display.repository')
->getViewDisplay('node', 'article', 'teaser')
->removeComponent('links')
->save();
$this
->drupalGet('node');
$this
->assertText($node
->getTitle());
$this
->assertSession()
->linkNotExists('Read more');
}
}
Classes
Name |
Description |
NodeLinksTest |
Tests the output of node links (read more, add new comment, etc). |