diff --git a/core/modules/node/src/Tests/NodeLinksTest.php b/core/modules/node/src/Tests/NodeLinksTest.php index f3873f5..4c0efa7 100644 --- a/core/modules/node/src/Tests/NodeLinksTest.php +++ b/core/modules/node/src/Tests/NodeLinksTest.php @@ -43,4 +43,5 @@ public function testHideLinks() { $this->assertText($node->getTitle()); $this->assertNoLink('Read more'); } -} + +} diff --git a/core/modules/node/src/Tests/Views/NodeFieldFilterTest.php b/core/modules/node/src/Tests/Views/NodeFieldFilterTest.php index d7ffc03..471b6df 100644 --- a/core/modules/node/src/Tests/Views/NodeFieldFilterTest.php +++ b/core/modules/node/src/Tests/Views/NodeFieldFilterTest.php @@ -116,11 +116,11 @@ protected function assertPageCounts($path, $counts, $message) { $this->drupalGet($path); $text = $this->getTextContent(); - // Check the counts. Note that the title and body are both shown on the - // page, and they are the same. So the title/body string should appear on - // the page twice as many times as the input count. + // Check the counts. Note that the title, the body and read more links are + // shown on the page, and they all contain the test string. So the string + // should appear on the page three times the input count. foreach ($counts as $langcode => $count) { - $this->assertEqual(substr_count($text, $this->node_titles[$langcode]), 2 * $count, 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message); + $this->assertEqual(substr_count($text, $this->node_titles[$langcode]), 3 * $count, 'Translation ' . $langcode . ' has count ' . $count . ' with ' . $message); } } } diff --git a/core/modules/node/src/Tests/Views/RowPluginTest.php b/core/modules/node/src/Tests/Views/RowPluginTest.php index 4813bd6..4c8574d 100644 --- a/core/modules/node/src/Tests/Views/RowPluginTest.php +++ b/core/modules/node/src/Tests/Views/RowPluginTest.php @@ -51,6 +51,8 @@ protected function setUp() { $this->drupalCreateContentType(array('type' => 'article')); // Create comment field on article. $this->container->get('comment.manager')->addDefaultField('node', 'article'); + // Hide links for the teaser view mode. + entity_get_display('node', 'article', 'default')->removeComponent('links')->save(); // Create two nodes, with 5 comments on all of them. for ($i = 0; $i < 2; $i++) { @@ -115,6 +117,8 @@ public function testRowPlugin() { foreach ($this->nodes as $node) { $this->assertFalse(strpos($output, $node->body->summary) !== FALSE, 'Make sure the teaser appears in the output of the view.'); $this->assertTrue(strpos($output, $node->body->value) !== FALSE, 'Make sure the full text appears in the output of the view.'); + $this->setRawContent($output); + $this->assertFalse($this->xpath('//li[contains(@class, :class)]/a[contains(@href, :href)]', array(':class' => 'node-readmore', ':href' => "node/{$node->id()}")), 'Make sure no readmore link appear.'); } // Test with teasers. @@ -124,28 +128,9 @@ public function testRowPlugin() { foreach ($this->nodes as $node) { $this->assertTrue(strpos($output, $node->body->summary) !== FALSE, 'Make sure the teaser appears in the output of the view.'); $this->assertFalse(strpos($output, $node->body->value) !== FALSE, 'Make sure the full text does not appears in the output of the view if teaser is set as viewmode.'); + $this->setRawContent($output); + $this->assertTrue($this->xpath('//li[contains(@class, :class)]/a[contains(@href, :href)]', array(':class' => 'node-readmore', ':href' => "node/{$node->id()}")), 'Make sure readmore link appears.'); } - - // Test with links disabled. - $view->rowPlugin->options['links'] = FALSE; - \Drupal::entityManager()->getViewBuilder('node')->resetCache(); - $output = $view->preview(); - $output = drupal_render($output); - $this->drupalSetContent($output); - foreach ($this->nodes as $node) { - $this->assertFalse($this->xpath('//li[contains(@class, :class)]/a[contains(@href, :href)]', array(':class' => 'node-readmore', ':href' => "node/{$node->id()}")), 'Make sure no readmore link appears.'); - } - - // Test with links enabled. - $view->rowPlugin->options['links'] = TRUE; - \Drupal::entityManager()->getViewBuilder('node')->resetCache(); - $output = $view->preview(); - $output = drupal_render($output); - $this->drupalSetContent($output); - foreach ($this->nodes as $node) { - $this->assertTrue($this->xpath('//li[contains(@class, :class)]/a[contains(@href, :href)]', array(':class' => 'node-readmore', ':href' => "node/{$node->id()}")), 'Make sure no readmore link appears.'); - } - } }