From 359aedf664b41d553665d62243d7943293b79d96 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 27 Jul 2013 19:31:31 -0500 Subject: [ticket/11744] Helper function to assert notifications in base test This also fixes tests PHPBB3-11744 --- tests/notification/base.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/notification/base.php') 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++; + } + } } -- cgit v1.2.1