annotate core/modules/node/tests/src/Functional/NodeLinksTest.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Tests\node\Functional;
Chris@0 4
Chris@0 5 use Drupal\node\NodeInterface;
Chris@0 6
Chris@0 7 /**
Chris@0 8 * Tests the output of node links (read more, add new comment, etc).
Chris@0 9 *
Chris@0 10 * @group node
Chris@0 11 */
Chris@0 12 class NodeLinksTest extends NodeTestBase {
Chris@0 13
Chris@0 14 /**
Chris@0 15 * Modules to enable.
Chris@0 16 *
Chris@0 17 * @var array
Chris@0 18 */
Chris@0 19 public static $modules = ['views'];
Chris@0 20
Chris@0 21 /**
Chris@0 22 * Tests that the links can be hidden in the view display settings.
Chris@0 23 */
Chris@0 24 public function testHideLinks() {
Chris@0 25 $node = $this->drupalCreateNode([
Chris@0 26 'type' => 'article',
Chris@0 27 'promote' => NodeInterface::PROMOTED,
Chris@0 28 ]);
Chris@0 29
Chris@0 30 // Links are displayed by default.
Chris@0 31 $this->drupalGet('node');
Chris@0 32 $this->assertText($node->getTitle());
Chris@0 33 $this->assertLink('Read more');
Chris@0 34
Chris@0 35 // Hide links.
Chris@0 36 entity_get_display('node', 'article', 'teaser')
Chris@0 37 ->removeComponent('links')
Chris@0 38 ->save();
Chris@0 39
Chris@0 40 $this->drupalGet('node');
Chris@0 41 $this->assertText($node->getTitle());
Chris@0 42 $this->assertNoLink('Read more');
Chris@0 43 }
Chris@0 44
Chris@0 45 }