aboutsummaryrefslogtreecommitdiffstats
path: root/tests/notification/base.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/notification/base.php')
-rw-r--r--tests/notification/base.php33
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/notification/base.php b/tests/notification/base.php
index 45b0b6f179..c898c76947 100644
--- a/tests/notification/base.php
+++ b/tests/notification/base.php
@@ -39,6 +39,13 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
);
}
+ protected function get_notification_methods()
+ {
+ return array(
+ 'notification.method.board',
+ );
+ }
+
protected function setUp()
{
parent::setUp();
@@ -55,6 +62,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
'allow_bookmarks' => true,
'allow_topic_notify' => true,
'allow_forum_notify' => true,
+ 'allow_board_notifications' => true,
));
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
@@ -87,7 +95,6 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
$phpbb_root_path,
$phpEx,
'phpbb_notification_types',
- 'phpbb_notifications',
'phpbb_user_notifications'
);
@@ -107,6 +114,18 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
$this->notifications->set_var('notification_types', $types);
+ $methods = array();
+ foreach ($this->get_notification_methods() as $method)
+ {
+ $method_parts = explode('.', $method);
+ $class = $this->build_type('phpbb\notification\method\\' . array_pop($method_parts));
+
+ $methods[$method] = $class;
+ $this->container->set($method, $class);
+ }
+
+ $this->notifications->set_var('notification_methods', $methods);
+
$this->db->sql_query('DELETE FROM phpbb_notification_types');
$this->db->sql_query('DELETE FROM phpbb_notifications');
$this->db->sql_query('DELETE FROM phpbb_user_notifications');
@@ -116,7 +135,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
{
global $phpbb_root_path, $phpEx;
- $instance = 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');
+ $instance = 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_user_notifications');
if ($type === 'phpbb\\notification\\type\\quote')
{
@@ -126,9 +145,17 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
return $instance;
}
+ protected function build_method($method)
+ {
+ global $phpbb_root_path, $phpEx;
+
+ return new $method($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(
+ $notifications = $this->notifications->load_notifications('notification.method.board', array_merge(array(
'count_unread' => true,
'order_by' => 'notification_time',
'order_dir' => 'ASC',