public function AuthcacheForumTest::testAuthcacheForumListNewTopicsFragment in Authenticated User Page Caching (Authcache) 7.2
Ensure that the number of new topics is reported accurately.
Covers AuthcacheForumListNewTopicsFragment
File
- modules/
authcache_forum/ authcache_forum.test, line 422 - Test cases for the Authcache Forum module.
Class
- AuthcacheForumTest
- Tests for markup substitution.
Code
public function testAuthcacheForumListNewTopicsFragment() {
// M1: Login and retrieve number-of-new-topics-setting for forum list.
$this
->drupalLogin($this->member1);
$url = authcache_p13n_request_get_callback('setting/forum-num-new', array(
'fn' => array(
$this->forum['tid'],
),
));
$this
->assertTrue($url);
$result = $this
->drupalGetAJAX($GLOBALS['base_root'] . $url['path'], $url['options'], array(
'X-Authcache: 1',
));
$expect = array(
'authcacheForumNumNew' => array(),
);
$this
->assertEqual($expect, $result, 'Should not report any new topics, member1 is the owner of the topic');
// M2: Login and retrieve number-of-new-topics-setting for forum list.
$this
->drupalLogin($this->member2);
$result = $this
->drupalGetAJAX($GLOBALS['base_root'] . $url['path'], $url['options'], array(
'X-Authcache: 1',
));
$expect = array(
'authcacheForumNumNew' => array(
$this->forum['tid'] => 1,
),
);
$this
->assertEqual($expect, $result, 'Should report one new topic for member2');
}