diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-11-09 20:35:37 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-11-09 20:35:37 +0100 |
commit | 95c2b12bf7be4e6ad1070d7dd11a9afd7fc1efa8 (patch) | |
tree | f7bab7e3aa86c67bf6ecdb92b9ccd4d9f15e7813 /tests | |
parent | 29d3b08d5097ad90a5ed2d26bfc981898732dbab (diff) | |
download | forums-95c2b12bf7be4e6ad1070d7dd11a9afd7fc1efa8.tar forums-95c2b12bf7be4e6ad1070d7dd11a9afd7fc1efa8.tar.gz forums-95c2b12bf7be4e6ad1070d7dd11a9afd7fc1efa8.tar.bz2 forums-95c2b12bf7be4e6ad1070d7dd11a9afd7fc1efa8.tar.xz forums-95c2b12bf7be4e6ad1070d7dd11a9afd7fc1efa8.zip |
[ticket/11896] Add functional tests for marking all notifications read
PHPBB3-11896
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/notification_test.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index 7f33ad1859..dd1b8ec981 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -52,4 +52,37 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case $this->assert_checkbox_is_unchecked($cplist, $checkbox_name); } } + + public function test_mark_notifications_read() + { + // Create a new standard user + $this->create_user('notificationtestuser'); + $this->add_user_group('NEWLY_REGISTERED', array('notificationtestuser')); + $this->login('notificationtestuser'); + $crawler = self::request('GET', 'index.php'); + $this->assertContains('notificationtestuser', $crawler->filter('.icon-logout')->text()); + + // Post a new post that needs approval + $this->create_post(2, 1, 'Re: Welcome to phpBB3', 'This is a test [b]post[/b] posted by notificationtestuser.', array(), 'POST_STORED_MOD'); + $crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}"); + $this->assertNotContains('This is a test post posted by notificationtestuser.', $crawler->filter('html')->text()); + + // logout + $crawler = self::request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout'); + + // admin login + $this->login(); + $this->add_lang('ucp'); + $crawler = self::request('GET', 'ucp.php?i=ucp_notifications'); + + // At least one notification should exist + $this->assertGreaterThan(0, $crawler->filter('#notification_list_button strong')->text()); + + // Get form token + $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); + $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); + $form = $crawler->selectButton($this->lang('YES'))->form(); + $crawler = self::submit($form); + $this->assertEquals(0, $crawler->filter('#notification_list_button strong')->text()); + } } |