aboutsummaryrefslogtreecommitdiffstats
path: root/tests/notification
diff options
context:
space:
mode:
Diffstat (limited to 'tests/notification')
-rw-r--r--tests/notification/base.php18
-rw-r--r--tests/notification/convert_test.php3
-rw-r--r--tests/notification/group_request_test.php5
-rw-r--r--tests/notification/manager_helper.php5
-rw-r--r--tests/notification/submit_post_base.php14
-rw-r--r--tests/notification/submit_post_type_quote_test.php38
-rw-r--r--tests/notification/submit_post_type_topic_test.php2
-rw-r--r--tests/notification/user_list_trim_test.php18
8 files changed, 63 insertions, 40 deletions
diff --git a/tests/notification/base.php b/tests/notification/base.php
index 162feae557..45b0b6f179 100644
--- a/tests/notification/base.php
+++ b/tests/notification/base.php
@@ -56,17 +56,20 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
'allow_topic_notify' => true,
'allow_forum_notify' => true,
));
- $user = $this->user = new \phpbb\user('\phpbb\datetime');
+ $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
+ $lang = new \phpbb\language\language($lang_loader);
+ $user = new \phpbb\user($lang, '\phpbb\datetime');
+ $this->user = $user;
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
$auth = $this->auth = new phpbb_mock_notifications_auth();
$cache = $this->cache = new \phpbb\cache\service(
- new \phpbb\cache\driver\null(),
+ new \phpbb\cache\driver\dummy(),
$this->config,
$this->db,
$phpbb_root_path,
$phpEx
);
-
+
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_container = $this->container = new phpbb_mock_container_builder();
@@ -113,7 +116,14 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
{
global $phpbb_root_path, $phpEx;
- 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');
+ $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');
+
+ if ($type === 'phpbb\\notification\\type\\quote')
+ {
+ $instance->set_utils(new \phpbb\textformatter\s9e\utils);
+ }
+
+ return $instance;
}
protected function assert_notifications($expected, $options = array())
diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php
index 32ab34c9bc..4a7fd89409 100644
--- a/tests/notification/convert_test.php
+++ b/tests/notification/convert_test.php
@@ -28,11 +28,12 @@ class phpbb_notification_convert_test extends phpbb_database_test_case
global $phpbb_root_path, $phpEx;
$this->db = $this->new_dbal();
+ $factory = new \phpbb\db\tools\factory();
$this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert(
new \phpbb\config\config(array()),
$this->db,
- new \phpbb\db\tools($this->db),
+ $factory->get($this->db),
$phpbb_root_path,
$phpEx,
'phpbb_'
diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php
index 0d1bda95ce..a24808fbbd 100644
--- a/tests/notification/group_request_test.php
+++ b/tests/notification/group_request_test.php
@@ -40,8 +40,6 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_content.' . $phpEx);
- set_config(false, false, false, $this->config);
-
$this->container->set('groupposition.legend', new \phpbb\groupposition\legend(
$this->db,
$this->user
@@ -52,7 +50,8 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
$this->cache->get_driver()
));
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
- $phpbb_log = new \phpbb\log\null();
+ $phpbb_log = new \phpbb\log\dummy();
+ $this->get_test_case_helpers()->set_s9e_services();
// Now on to the actual test
diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php
index 75b7275d3a..48bf5b177b 100644
--- a/tests/notification/manager_helper.php
+++ b/tests/notification/manager_helper.php
@@ -48,6 +48,11 @@ class phpbb_notification_manager_helper extends \phpbb\notification\manager
$item = new $item_type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
+ if ($item_type === 'phpbb\\notification\\type\\quote')
+ {
+ $item->set_utils(new \phpbb\textformatter\s9e\utils);
+ }
+
$item->set_notification_manager($this);
$item->set_initial_data($data);
diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php
index 5e770f71c9..04fb6658c3 100644
--- a/tests/notification/submit_post_base.php
+++ b/tests/notification/submit_post_base.php
@@ -70,11 +70,9 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
// Config
$config = new \phpbb\config\config(array('num_topics' => 1,'num_posts' => 1,));
- set_config(null, null, null, $config);
- set_config_count(null, null, null, $config);
$cache = new \phpbb\cache\service(
- new \phpbb\cache\driver\null(),
+ new \phpbb\cache\driver\dummy(),
$config,
$db,
$phpbb_root_path,
@@ -85,7 +83,10 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
// User
- $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
+ $user = $this->getMock('\phpbb\user', array(), array(
+ new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
+ '\phpbb\datetime'
+ ));
$user->ip = '';
$user->data = array(
'user_id' => 2,
@@ -116,6 +117,11 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
$phpbb_root_path, $phpEx,
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
+ if ($type === 'quote')
+ {
+ $class->set_utils(new \phpbb\textformatter\s9e\utils);
+ }
+
$phpbb_container->set('notification.type.' . $type, $class);
$notification_types_array['notification.type.' . $type] = $class;
diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php
index 61e3840773..8ad6a62b09 100644
--- a/tests/notification/submit_post_type_quote_test.php
+++ b/tests/notification/submit_post_type_quote_test.php
@@ -51,6 +51,8 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_
*/
public function submit_post_data()
{
+ $parser = $this->get_test_case_helpers()->set_s9e_services()->get('text_formatter.parser');
+
return array(
/**
* Normal post
@@ -65,15 +67,15 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_
*/
array(
array(
- 'message' => implode(' ', array(
- '[quote="poster":uid]poster should not be notified[/quote:uid]',
- '[quote="test":uid]test should be notified[/quote:uid]',
- '[quote="unauthorized":uid]unauthorized to read, should not receive a notification[/quote:uid]',
- '[quote="notified":uid]already notified, should not receive a new notification[/quote:uid]',
- '[quote="disabled":uid]option disabled, should not receive a notification[/quote:uid]',
- '[quote="default":uid]option set to default, should receive a notification[/quote:uid]',
- '[quote="doesn\'t exist":uid]user does not exist, should not receive a notification[/quote:uid]',
- )),
+ 'message' => $parser->parse(implode(' ', array(
+ '[quote="poster"]poster should not be notified[/quote]',
+ '[quote="test"]test should be notified[/quote]',
+ '[quote="unauthorized"]unauthorized to read, should not receive a notification[/quote]',
+ '[quote="notified"]already notified, should not receive a new notification[/quote]',
+ '[quote="disabled"]option disabled, should not receive a notification[/quote]',
+ '[quote="default"]option set to default, should receive a notification[/quote]',
+ '[quote="doesn\'t exist"]user does not exist, should not receive a notification[/quote]',
+ ))),
'bbcode_uid' => 'uid',
),
array(
@@ -94,15 +96,15 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_
*/
array(
array(
- 'message' => implode(' ', array(
- '[quote="poster":uid]poster should not be notified[/quote:uid]',
- '[quote="test":uid]test should be notified[/quote:uid]',
- '[quote="unauthorized":uid]unauthorized to read, should not receive a notification[/quote:uid]',
- '[quote="notified":uid]already notified, should not receive a new notification[/quote:uid]',
- '[quote="disabled":uid]option disabled, should not receive a notification[/quote:uid]',
- '[quote="default":uid]option set to default, should receive a notification[/quote:uid]',
- '[quote="doesn\'t exist":uid]user does not exist, should not receive a notification[/quote:uid]',
- )),
+ 'message' => $parser->parse(implode(' ', array(
+ '[quote="poster"]poster should not be notified[/quote]',
+ '[quote="test"]test should be notified[/quote]',
+ '[quote="unauthorized"]unauthorized to read, should not receive a notification[/quote]',
+ '[quote="notified"]already notified, should not receive a new notification[/quote]',
+ '[quote="disabled"]option disabled, should not receive a notification[/quote]',
+ '[quote="default"]option set to default, should receive a notification[/quote]',
+ '[quote="doesn\'t exist"]user does not exist, should not receive a notification[/quote]',
+ ))),
'bbcode_uid' => 'uid',
'force_approved_state' => false,
),
diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php
index c095fbc4ba..f14f305517 100644
--- a/tests/notification/submit_post_type_topic_test.php
+++ b/tests/notification/submit_post_type_topic_test.php
@@ -42,7 +42,7 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_
),
)));
- $phpbb_log = $this->getMock('\phpbb\log\null');
+ $phpbb_log = $this->getMock('\phpbb\log\dummy');
}
/**
diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php
index c43eff729c..f7b4fcb215 100644
--- a/tests/notification/user_list_trim_test.php
+++ b/tests/notification/user_list_trim_test.php
@@ -33,11 +33,9 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
$db = $this->new_dbal();
$config = new \phpbb\config\config(array());
- set_config(null, null, null, $config);
- set_config_count(null, null, null, $config);
$cache = new \phpbb\cache\service(
- new \phpbb\cache\driver\null(),
+ new \phpbb\cache\driver\dummy(),
$config,
$db,
$phpbb_root_path,
@@ -53,7 +51,9 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
array('u_viewprofile', 1, false),
)));
- $user = new \phpbb\user('\phpbb\datetime');
+ $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
+ $lang = new \phpbb\language\language($lang_loader);
+ $user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data = array('user_lang' => 'en');
$user->add_lang('common');
@@ -73,7 +73,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
'topic_title' => 'Test',
'poster_id' => 2,
'post_username' => 'A',
- 'responders' => null,
+ 'responders' => null,
),
'<strong>Reply</strong> from A in topic:',
),
@@ -84,7 +84,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
'post_username' => 'A',
'responders' => array(
array('username' => '', 'poster_id' => 3),
- ),
+ ),
),
'<strong>Reply</strong> from A and <span class="username">B</span> in topic:',
),
@@ -96,7 +96,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
'responders' => array(
array('username' => '', 'poster_id' => 3),
array('username' => '', 'poster_id' => 4),
- ),
+ ),
),
'<strong>Reply</strong> from A, <span class="username">B</span>, and <span class="username">C</span> in topic:',
),
@@ -109,7 +109,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
array('username' => '', 'poster_id' => 3),
array('username' => '', 'poster_id' => 4),
array('username' => '', 'poster_id' => 5),
- ),
+ ),
),
'<strong>Reply</strong> from A, <span class="username">B</span>, <span class="username">C</span>, and <span class="username">D</span> in topic:',
),
@@ -123,7 +123,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
array('username' => '', 'poster_id' => 4),
array('username' => '', 'poster_id' => 5),
array('username' => '', 'poster_id' => 6),
- ),
+ ),
),
'<strong>Reply</strong> from A, <span class="username">B</span>, <span class="username">C</span>, and 2 others in topic:',
),