diff --git a/tests/notification/fixtures/submit_post_bookmark.xml b/tests/notification/fixtures/submit_post_bookmark.xml
index b669d4c1b6..d4bf8df73f 100644
--- a/tests/notification/fixtures/submit_post_bookmark.xml
+++ b/tests/notification/fixtures/submit_post_bookmark.xml
@@ -29,14 +29,14 @@
- item_type
+ notification_type_id
user_id
item_id
item_parent_id
notification_read
notification_data
- bookmark
+ 1
5
1
1
@@ -45,9 +45,11 @@
- notification_type
+ notification_type_id
+ notification_type_name
notification_type_enabled
+ 1
bookmark
1
diff --git a/tests/notification/fixtures/submit_post_post.xml b/tests/notification/fixtures/submit_post_post.xml
index cead4f7c26..b0ffa042c5 100644
--- a/tests/notification/fixtures/submit_post_post.xml
+++ b/tests/notification/fixtures/submit_post_post.xml
@@ -21,14 +21,14 @@
- item_type
+ notification_type_id
user_id
item_id
item_parent_id
notification_read
notification_data
- post
+ 1
5
1
1
@@ -36,7 +36,7 @@
- post
+ 1
8
1
1
@@ -45,9 +45,11 @@
- notification_type
+ notification_type_id
+ notification_type_name
notification_type_enabled
+ 1
post
1
diff --git a/tests/notification/fixtures/submit_post_post_in_queue.xml b/tests/notification/fixtures/submit_post_post_in_queue.xml
index eedcebf71d..090e90ea49 100644
--- a/tests/notification/fixtures/submit_post_post_in_queue.xml
+++ b/tests/notification/fixtures/submit_post_post_in_queue.xml
@@ -1,14 +1,14 @@
- item_type
+ notification_type_id
user_id
item_id
item_parent_id
notification_read
notification_data
- post_in_queue
+ 1
6
1
1
@@ -17,9 +17,11 @@
- notification_type
+ notification_type_id
+ notification_type_name
notification_type_enabled
+ 1
post_in_queue
1
diff --git a/tests/notification/fixtures/submit_post_quote.xml b/tests/notification/fixtures/submit_post_quote.xml
index 884a84af4a..f22ed97d91 100644
--- a/tests/notification/fixtures/submit_post_quote.xml
+++ b/tests/notification/fixtures/submit_post_quote.xml
@@ -1,14 +1,14 @@
- item_type
+ notification_type_id
user_id
item_id
item_parent_id
notification_read
notification_data
- quote
+ 1
5
1
1
@@ -17,9 +17,11 @@
- notification_type
+ notification_type_id
+ notification_type_name
notification_type_enabled
+ 1
quote
1
diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php
index 5fbcfc8776..c3dbfc2535 100644
--- a/tests/notification/submit_post_base.php
+++ b/tests/notification/submit_post_base.php
@@ -52,9 +52,6 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
$this->db = $this->new_dbal();
$db = $this->db;
- // Cache
- $cache = new phpbb_mock_cache();
-
// Auth
$auth = $this->getMock('phpbb_auth');
$auth->expects($this->any())
@@ -72,6 +69,14 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
+ $cache = new phpbb_cache_service(
+ new phpbb_cache_driver_null(),
+ $config,
+ $db,
+ $phpbb_root_path,
+ $phpEx
+ );
+
// Event dispatcher
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
@@ -94,23 +99,28 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
$user_loader = new phpbb_user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
- // Notification Manager
- $phpbb_notifications = new phpbb_notification_manager(array(), array(),
- $phpbb_container, $user_loader, $db, $user,
- $phpbb_root_path, $phpEx,
- NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
- $phpbb_container->set('notification_manager', $phpbb_notifications);
-
// Notification Types
- $notification_types = array('quote', 'bookmark', 'post', 'post_in_queue');
+ $notification_types = array('quote', 'bookmark', 'post', 'post_in_queue', 'topic', 'approve_topic', 'approve_post');
+ $notification_types_array = array();
foreach ($notification_types as $type)
{
$class_name = 'phpbb_notification_type_' . $type;
- $phpbb_container->set('notification.type.' . $type, new $class_name(
+ $class = new $class_name(
$user_loader, $db, $cache, $user, $auth, $config,
$phpbb_root_path, $phpEx,
- NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE));
+ NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
+
+ $phpbb_container->set('notification.type.' . $type, $class);
+
+ $notification_types_array['notification.type.' . $type] = $class;
}
+
+ // Notification Manager
+ $phpbb_notifications = new phpbb_notification_manager($notification_types_array, array(),
+ $phpbb_container, $user_loader, $db, $cache, $user,
+ $phpbb_root_path, $phpEx,
+ NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
+ $phpbb_container->set('notification_manager', $phpbb_notifications);
}
/**
@@ -119,7 +129,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
public function test_submit_post($additional_post_data, $expected_before, $expected_after)
{
$sql = 'SELECT user_id, item_id, item_parent_id
- FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATIONS_TYPES_TABLE . " nt
+ FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt
WHERE nt.notification_type_name = '" . $this->item_type . "'
AND n.notification_type_id = nt.notification_type_id
ORDER BY user_id, item_id ASC";
@@ -132,7 +142,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
submit_post('reply', '', 'poster-name', POST_NORMAL, $poll_data, $post_data, false, false);
$sql = 'SELECT user_id, item_id, item_parent_id
- FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATIONS_TYPES_TABLE . " nt
+ FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt
WHERE nt.notification_type_name = '" . $this->item_type . "'
AND n.notification_type_id = nt.notification_type_id
ORDER BY user_id ASC, item_id ASC";