Skip to content
Snippets Groups Projects
Commit 8db34bb2 authored by Angie Byron's avatar Angie Byron
Browse files

#877020 follow-up by andypost: Updated hotfix for _forum_topics_unread() tests to fix testbot.

parent e60d38c7
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -71,8 +71,25 @@ class ForumTestCase extends DrupalWebTestCase {
// Verify the topic and post counts on the forum page.
$this->drupalGet('forum');
$this->assertRaw("<td class=\"topics\">\n 6 <br />\n <a href=\"/forum/3#new\">5 new</a>\n </td>");
$this->assertRaw('<td class="posts">6</td>');
// Verify row for testing forum.
$forum_arg = array(':forum' => 'forum-list-' . $this->forum['tid']);
// Topics cell contains number of topics and number of unread topics.
$xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]', $forum_arg);
$topics = $this->xpath($xpath);
$topics = trim($topics[0]);
$this->assertEqual($topics, '6', t('Number of topics found.'));
// Verify the number of unread topics.
$unread_topics = _forum_topics_unread($this->forum['tid'], $this->edit_any_topics_user->uid);
$unread_topics = format_plural($unread_topics, '1 new', '@count new');
$xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]//a', $forum_arg);
$this->assertFieldByXPath($xpath, $unread_topics, t('Number of unread topics found.'));
// Verify total number of posts in forum.
$xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="posts"]', $forum_arg);
$this->assertFieldByXPath($xpath, '6', t('Number of posts found.'));
// Test loading multiple forum nodes on the front page.
$this->drupalLogin($this->drupalCreateUser(array('administer content types', 'create forum content')));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment