Issue #2228941 by larowlan, andrei.dincu | Cottser: PHP notice displayed for forum blocks when there are no forum topics.
parent
27a651a6e7
commit
5c1869b612
|
@ -21,6 +21,7 @@ abstract class ForumBlockBase extends BlockBase {
|
||||||
*/
|
*/
|
||||||
public function build() {
|
public function build() {
|
||||||
$result = $this->buildForumQuery()->execute();
|
$result = $this->buildForumQuery()->execute();
|
||||||
|
$elements = array();
|
||||||
if ($node_title_list = node_title_list($result)) {
|
if ($node_title_list = node_title_list($result)) {
|
||||||
$elements['forum_list'] = $node_title_list;
|
$elements['forum_list'] = $node_title_list;
|
||||||
$elements['forum_more'] = array(
|
$elements['forum_more'] = array(
|
||||||
|
|
|
@ -55,13 +55,14 @@ class ForumBlockTest extends WebTestBase {
|
||||||
public function testNewForumTopicsBlock() {
|
public function testNewForumTopicsBlock() {
|
||||||
$this->drupalLogin($this->adminUser);
|
$this->drupalLogin($this->adminUser);
|
||||||
|
|
||||||
// Create 5 forum topics.
|
|
||||||
$topics = $this->createForumTopics();
|
|
||||||
|
|
||||||
// Enable the new forum topics block.
|
// Enable the new forum topics block.
|
||||||
$block = $this->drupalPlaceBlock('forum_new_block');
|
$block = $this->drupalPlaceBlock('forum_new_block');
|
||||||
$this->drupalGet('');
|
$this->drupalGet('');
|
||||||
|
|
||||||
|
// Create 5 forum topics.
|
||||||
|
$topics = $this->createForumTopics();
|
||||||
|
|
||||||
|
|
||||||
$this->assertLink(t('More'), 0, 'New forum topics block has a "more"-link.');
|
$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.');
|
$this->assertLinkByHref('forum', 0, 'New forum topics block has a "more"-link.');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue