diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-07-27 19:31:31 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-07-27 19:31:31 -0500 |
commit | 359aedf664b41d553665d62243d7943293b79d96 (patch) | |
tree | 07b023aaac0db7ab6331482ac4c7110cd61424f0 /tests/notification/base.php | |
parent | b213be84a7ff0f947de0025dcc4620142edf226b (diff) | |
download | forums-359aedf664b41d553665d62243d7943293b79d96.tar forums-359aedf664b41d553665d62243d7943293b79d96.tar.gz forums-359aedf664b41d553665d62243d7943293b79d96.tar.bz2 forums-359aedf664b41d553665d62243d7943293b79d96.tar.xz forums-359aedf664b41d553665d62243d7943293b79d96.zip |
[ticket/11744] Helper function to assert notifications in base test
This also fixes tests
PHPBB3-11744
Diffstat (limited to 'tests/notification/base.php')
-rw-r--r-- | tests/notification/base.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/notification/base.php b/tests/notification/base.php index 5ef6fcebad..8de162a1fb 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -106,4 +106,26 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case return new $type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $phpbb_root_path, $phpEx, 'phpbb_notification_types', 'phpbb_notifications', 'phpbb_user_notifications'); } + + protected function assert_notifications($expected, $options = array()) + { + $notifications = $this->notifications->load_notifications(array_merge(array( + 'count_unread' => true, + 'order_by' => 'notification_time', + 'order_dir' => 'ASC', + ), $options)); + + $this->assertEquals(sizeof($expected), $notifications['unread_count']); + + $i = 0; + foreach ($notifications['notifications'] as $notification) + { + foreach ($expected[$i] as $key => $value) + { + $this->assertEquals($value, $notification->$key, $i . ' ' . $key); + } + + $i++; + } + } } |