diff --git a/core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php b/core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php index 6b760a95489..d7dfc31ee95 100644 --- a/core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php +++ b/core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php @@ -21,6 +21,7 @@ abstract class ForumBlockBase extends BlockBase { */ public function build() { $result = $this->buildForumQuery()->execute(); + $elements = array(); if ($node_title_list = node_title_list($result)) { $elements['forum_list'] = $node_title_list; $elements['forum_more'] = array( diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php index 3799288956d..1295c822aaf 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php @@ -55,13 +55,14 @@ class ForumBlockTest extends WebTestBase { public function testNewForumTopicsBlock() { $this->drupalLogin($this->adminUser); - // Create 5 forum topics. - $topics = $this->createForumTopics(); - // Enable the new forum topics block. $block = $this->drupalPlaceBlock('forum_new_block'); $this->drupalGet(''); + // Create 5 forum topics. + $topics = $this->createForumTopics(); + + $this->assertLink(t('More'), 0, 'New forum topics block has a "more"-link.'); $this->assertLinkByHref('forum', 0, 'New forum topics block has a "more"-link.');