comparison core/modules/node/tests/src/Functional/NodeLinksTest.php @ 0:4c8ae668cc8c

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