diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/node/tests/src/Functional/NodeLinksTest.php	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,45 @@
+<?php
+
+namespace Drupal\Tests\node\Functional;
+
+use Drupal\node\NodeInterface;
+
+/**
+ * Tests the output of node links (read more, add new comment, etc).
+ *
+ * @group node
+ */
+class NodeLinksTest extends NodeTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['views'];
+
+  /**
+   * Tests that the links can be hidden in the view display settings.
+   */
+  public function testHideLinks() {
+    $node = $this->drupalCreateNode([
+      'type' => 'article',
+      'promote' => NodeInterface::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');
+  }
+
+}