aboutsummaryrefslogtreecommitdiffstats
path: root/tests/notification
diff options
context:
space:
mode:
Diffstat (limited to 'tests/notification')
-rw-r--r--tests/notification/base.php131
-rw-r--r--tests/notification/convert_test.php6
-rw-r--r--tests/notification/ext/test/notification/type/test.php4
-rw-r--r--tests/notification/fixtures/group_request.xml30
-rw-r--r--tests/notification/group_request_test.php109
-rw-r--r--tests/notification/manager_helper.php6
-rw-r--r--tests/notification/notification_test.php367
-rw-r--r--tests/notification/submit_post_base.php22
8 files changed, 410 insertions, 265 deletions
diff --git a/tests/notification/base.php b/tests/notification/base.php
new file mode 100644
index 0000000000..549545f01b
--- /dev/null
+++ b/tests/notification/base.php
@@ -0,0 +1,131 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/manager_helper.php';
+
+abstract class phpbb_tests_notification_base extends phpbb_database_test_case
+{
+ protected $notifications, $db, $container, $user, $config, $auth, $cache;
+
+ protected function get_notification_types()
+ {
+ return array(
+ 'test',
+ 'approve_post',
+ 'approve_topic',
+ 'bookmark',
+ 'disapprove_post',
+ 'disapprove_topic',
+ 'pm',
+ 'post',
+ 'post_in_queue',
+ 'quote',
+ 'report_pm',
+ 'report_pm_closed',
+ 'report_post',
+ 'report_post_closed',
+ 'topic',
+ 'topic_in_queue',
+ );
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ global $phpbb_root_path, $phpEx;
+
+ include_once(__DIR__ . '/ext/test/notification/type/test.' . $phpEx);
+
+ global $db, $config, $user, $auth, $cache, $phpbb_container;
+
+ $db = $this->db = $this->new_dbal();
+ $config = $this->config = new \phpbb\config\config(array(
+ 'allow_privmsg' => true,
+ 'allow_bookmarks' => true,
+ 'allow_topic_notify' => true,
+ 'allow_forum_notify' => true,
+ ));
+ $user = $this->user = new \phpbb\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(),
+ $this->config,
+ $this->db,
+ $phpbb_root_path,
+ $phpEx
+ );
+
+ $phpbb_container = $this->container = new phpbb_mock_container_builder();
+
+ $this->notifications = new phpbb_notification_manager_helper(
+ array(),
+ array(),
+ $this->container,
+ $this->user_loader,
+ $this->db,
+ $this->cache,
+ $this->user,
+ $phpbb_root_path,
+ $phpEx,
+ 'phpbb_notification_types',
+ 'phpbb_notifications',
+ 'phpbb_user_notifications'
+ );
+
+ $phpbb_container->set('notification_manager', $this->notifications);
+
+ $this->notifications->setDependencies($this->auth, $this->config);
+
+ $types = array();
+ foreach ($this->get_notification_types() as $type)
+ {
+ $class = $this->build_type('phpbb\notification\type\\' . $type);
+
+ $types[$type] = $class;
+ $this->container->set('notification.type.' . $type, $class);
+ }
+
+ $this->notifications->set_var('notification_types', $types);
+
+ $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');
+ }
+
+ protected function build_type($type)
+ {
+ 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');
+ }
+
+ 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++;
+ }
+ }
+}
diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php
index c038020385..ed1fa9b1bf 100644
--- a/tests/notification/convert_test.php
+++ b/tests/notification/convert_test.php
@@ -25,10 +25,10 @@ class phpbb_notification_convert_test extends phpbb_database_test_case
$this->db = $this->new_dbal();
- $this->migration = new phpbb_db_migration_data_310_notification_options_reconvert(
- new phpbb_config(array()),
+ $this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert(
+ new \phpbb\config\config(array()),
$this->db,
- new phpbb_db_tools($this->db),
+ new \phpbb\db\tools($this->db),
$phpbb_root_path,
$phpEx,
'phpbb_'
diff --git a/tests/notification/ext/test/notification/type/test.php b/tests/notification/ext/test/notification/type/test.php
index 0d0c584e0d..cdb921ca3b 100644
--- a/tests/notification/ext/test/notification/type/test.php
+++ b/tests/notification/ext/test/notification/type/test.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -15,7 +17,7 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_notification_type_test extends phpbb_notification_type_base
+class test extends \phpbb\notification\type\base
{
public function get_type()
{
diff --git a/tests/notification/fixtures/group_request.xml b/tests/notification/fixtures/group_request.xml
new file mode 100644
index 0000000000..1eb73f1e15
--- /dev/null
+++ b/tests/notification/fixtures/group_request.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>2</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>3</value>
+ <value>3</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php
new file mode 100644
index 0000000000..b812fff8f8
--- /dev/null
+++ b/tests/notification/group_request_test.php
@@ -0,0 +1,109 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/base.php';
+
+class phpbb_notification_group_request_test extends phpbb_tests_notification_base
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/group_request.xml');
+ }
+
+ protected function get_notification_types()
+ {
+ return array_merge(
+ parent::get_notification_types(),
+ array(
+ 'group_request',
+ 'group_request_approved',
+ )
+ );
+ }
+
+ public function test_notifications()
+ {
+ global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_log;
+
+ include_once($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
+ 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
+ ));
+ $this->container->set('groupposition.teampage', new \phpbb\groupposition\teampage(
+ $this->db,
+ $this->user,
+ $this->cache->get_driver()
+ ));
+ $phpbb_dispatcher = new phpbb_mock_event_dispatcher;
+ $phpbb_log = new \phpbb\log\null();
+
+ // Now on to the actual test
+
+ $group_id = false;
+ group_create($group_id, GROUP_OPEN, 'test', 'test group', array());
+
+ // Add user 2 as group leader
+ group_user_add($group_id, 2, false, false, false, true, false);
+
+ // Add user 3 as pending
+ group_user_add($group_id, 3, false, false, false, false, true);
+
+ $this->assert_notifications(
+ array(
+ // user 3 pending notification
+ array(
+ 'item_id' => 3, // user_id of requesting join
+ 'item_parent_id' => $group_id,
+ 'user_id' => 2,
+ 'notification_read' => 0,
+ 'notification_data' => array(
+ 'group_name' => 'test',
+ ),
+ ),
+ ),
+ array(
+ 'user_id' => 2,
+ )
+ );
+
+ // Approve user 3 joining the group
+ group_user_attributes('approve', $group_id, array(3));
+
+ // user 3 pending notification should have been deleted
+ $this->assert_notifications(
+ array(),
+ array(
+ 'user_id' => 2,
+ )
+ );
+
+ $this->assert_notifications(
+ array(
+ // user 3 approved notification
+ array(
+ 'item_id' => $group_id, // user_id of requesting join
+ 'user_id' => 3,
+ 'notification_read' => 0,
+ 'notification_data' => array(
+ 'group_name' => 'test',
+ ),
+ ),
+ ),
+ array(
+ 'user_id' => 3,
+ )
+ );
+ }
+}
diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php
index 7a794f922f..731dd00b7a 100644
--- a/tests/notification/manager_helper.php
+++ b/tests/notification/manager_helper.php
@@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
* Notifications service class
* @package notifications
*/
-class phpbb_notification_manager_helper extends phpbb_notification_manager
+class phpbb_notification_manager_helper extends \phpbb\notification\manager
{
public function set_var($name, $value)
{
@@ -40,7 +40,7 @@ class phpbb_notification_manager_helper extends phpbb_notification_manager
*/
public function get_item_type_class($item_type, $data = array())
{
- $item_type = 'phpbb_notification_type_' . $item_type;
+ $item_type = 'phpbb\notification\type\\' . $item_type;
$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);
@@ -56,7 +56,7 @@ class phpbb_notification_manager_helper extends phpbb_notification_manager
*/
public function get_method_class($method_name)
{
- $method_name = 'phpbb_notification_method_' . $method_name;
+ $method_name = 'phpbb\notification\method\\' . $method_name;
$method = new $method_name($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);
diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php
index 8f7eb3b8a8..e1788e8670 100644
--- a/tests/notification/notification_test.php
+++ b/tests/notification/notification_test.php
@@ -7,9 +7,9 @@
*
*/
-require_once dirname(__FILE__) . '/manager_helper.php';
+require_once dirname(__FILE__) . '/base.php';
-class phpbb_notification_test extends phpbb_database_test_case
+class phpbb_notification_test extends phpbb_tests_notification_base
{
protected $notifications, $db, $container, $user, $config, $auth, $cache;
@@ -18,98 +18,17 @@ class phpbb_notification_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/notification.xml');
}
- protected function setUp()
- {
- parent::setUp();
-
- global $phpbb_root_path, $phpEx;
-
- include_once(__DIR__ . '/ext/test/notification/type/test.' . $phpEx);
-
- $this->db = $this->new_dbal();
- $this->config = new phpbb_config(array(
- 'allow_privmsg' => true,
- 'allow_bookmarks' => true,
- 'allow_topic_notify' => true,
- 'allow_forum_notify' => true,
- ));
- $this->user = new phpbb_user();
- $this->user_loader = new phpbb_user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
- $this->auth = new phpbb_mock_notifications_auth();
- $this->cache = new phpbb_cache_service(
- new phpbb_cache_driver_null(),
- $this->config,
- $this->db,
- $phpbb_root_path,
- $phpEx
- );
-
- $this->container = new phpbb_mock_container_builder();
-
- $this->notifications = new phpbb_notification_manager_helper(
- array(),
- array(),
- $this->container,
- $this->user_loader,
- $this->db,
- $this->cache,
- $this->user,
- $phpbb_root_path,
- $phpEx,
- 'phpbb_notification_types',
- 'phpbb_notifications',
- 'phpbb_user_notifications'
- );
-
- $this->notifications->setDependencies($this->auth, $this->config);
-
- $types = array();
- foreach (array(
- 'test',
- 'approve_post',
- 'approve_topic',
- 'bookmark',
- 'disapprove_post',
- 'disapprove_topic',
- 'pm',
- 'post',
- 'post_in_queue',
- 'quote',
- 'report_pm',
- 'report_pm_closed',
- 'report_post',
- 'report_post_closed',
- 'topic',
- 'topic_in_queue',
- ) as $type)
- {
- $class = $this->build_type('phpbb_notification_type_' . $type);
-
- $types[$type] = $class;
- $this->container->set('notification.type.' . $type, $class);
- }
-
- $this->notifications->set_var('notification_types', $types);
- }
-
- protected function build_type($type)
- {
- 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');
- }
-
public function test_get_notification_type_id()
{
// They should be inserted the first time
- $this->assertEquals(1, $this->notifications->get_notification_type_id('post'));
- $this->assertEquals(2, $this->notifications->get_notification_type_id('quote'));
- $this->assertEquals(3, $this->notifications->get_notification_type_id('test'));
+ $post_type_id = $this->notifications->get_notification_type_id('post');
+ $quote_type_id = $this->notifications->get_notification_type_id('quote');
+ $test_type_id = $this->notifications->get_notification_type_id('test');
$this->assertEquals(array(
- 'test' => 3,
- 'quote' => 2,
- 'post' => 1,
+ 'test' => $test_type_id,
+ 'quote' => $quote_type_id,
+ 'post' => $post_type_id,
),
$this->notifications->get_notification_type_ids(array(
'test',
@@ -117,11 +36,11 @@ class phpbb_notification_test extends phpbb_database_test_case
'post',
)
));
- $this->assertEquals(2, $this->notifications->get_notification_type_id('quote'));
+ $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('quote'));
try
{
- $this->assertEquals(3, $this->notifications->get_notification_type_id('fail'));
+ $this->assertEquals(false, $this->notifications->get_notification_type_id('fail'));
$this->fail('Non-existent type should throw an exception');
}
@@ -241,88 +160,65 @@ class phpbb_notification_test extends phpbb_database_test_case
'post_time' => 1349413326,
));
- $notifications = $this->notifications->load_notifications(array(
- 'count_unread' => true,
- ));
-
- $expected = array(
- 1 => array(
- 'notification_type_id' => 4,
- 'item_id' => 1,
- 'item_parent_id' => 1,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413321,
- 'notification_data' => array(),
- ),
- 2 => array(
- 'notification_type_id' => 4,
- 'item_id' => 2,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413322,
- 'notification_data' => array(),
- ),
- 3 => array(
- 'notification_type_id' => 4,
- 'item_id' => 3,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413323,
- 'notification_data' => array(),
- ),
- 4 => array(
- 'notification_type_id' => 3,
- 'item_id' => 4,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413324,
- 'notification_data' => array(
- 'poster_id' => 2,
- 'topic_title' => 'test-title',
- 'post_subject' => 'Re: test-title',
- 'post_username' => '',
- 'forum_id' => 2,
- 'forum_name' => 'Your first forum',
+ $this->assert_notifications(
+ array(
+ array(
+ 'item_id' => 1,
+ 'item_parent_id' => 1,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413321,
+ 'notification_data' => array(),
),
- ),
- 5 => array(
- 'notification_type_id' => 2,
- 'item_id' => 5,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413325,
- 'notification_data' => array(
- 'poster_id' => 2,
- 'topic_title' => 'test-title',
- 'post_subject' => 'Re: test-title',
- 'post_username' => '',
- 'forum_id' => 2,
- 'forum_name' => 'Your first forum',
+ array(
+ 'item_id' => 2,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413322,
+ 'notification_data' => array(),
),
- ),
+ array(
+ 'item_id' => 3,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413323,
+ 'notification_data' => array(),
+ ),
+ array(
+ 'item_id' => 4,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413324,
+ 'notification_data' => array(
+ 'poster_id' => 2,
+ 'topic_title' => 'test-title',
+ 'post_subject' => 'Re: test-title',
+ 'post_username' => '',
+ 'forum_id' => 2,
+ 'forum_name' => 'Your first forum',
+ ),
+ ),
+ array(
+ 'item_id' => 5,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413325,
+ 'notification_data' => array(
+ 'poster_id' => 2,
+ 'topic_title' => 'test-title',
+ 'post_subject' => 'Re: test-title',
+ 'post_username' => '',
+ 'forum_id' => 2,
+ 'forum_name' => 'Your first forum',
+ ),
+ ),
+ )
);
- $this->assertEquals(sizeof($expected), $notifications['unread_count']);
-
- $notifications = $notifications['notifications'];
-
- foreach ($expected as $notification_id => $notification_data)
- {
- //echo $notifications[$notification_id];
-
- $this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
-
- foreach ($notification_data as $key => $value)
- {
- $this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
- }
- }
-
// Now test updating -------------------------------
$this->notifications->update_notifications('test', array(
@@ -347,86 +243,63 @@ class phpbb_notification_test extends phpbb_database_test_case
'forum_name' => 'Your second forum', // change forum_name
));
- $notifications = $this->notifications->load_notifications(array(
- 'count_unread' => true,
- ));
-
- $expected = array(
- 1 => array(
- 'notification_type_id' => 4,
- 'item_id' => 1,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413321,
- 'notification_data' => array(),
- ),
- 2 => array(
- 'notification_type_id' => 4,
- 'item_id' => 2,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413322,
- 'notification_data' => array(),
- ),
- 3 => array(
- 'notification_type_id' => 4,
- 'item_id' => 3,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1234,
- 'notification_data' => array(),
- ),
- 4 => array(
- 'notification_type_id' => 3,
- 'item_id' => 4,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413324,
- 'notification_data' => array(
- 'poster_id' => 2,
- 'topic_title' => 'test-title',
- 'post_subject' => 'Re: test-title',
- 'post_username' => '',
- 'forum_id' => 2,
- 'forum_name' => 'Your first forum',
+ $this->assert_notifications(
+ array(
+ array(
+ 'item_id' => 3,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1234,
+ 'notification_data' => array(),
),
- ),
- 5 => array(
- 'notification_type_id' => 2,
- 'item_id' => 5,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413325,
- 'notification_data' => array(
- 'poster_id' => 2,
- 'topic_title' => 'test-title2',
- 'post_subject' => 'Re: test-title2',
- 'post_username' => '',
- 'forum_id' => 3,
- 'forum_name' => 'Your second forum',
+ array(
+ 'item_id' => 1,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413321,
+ 'notification_data' => array(),
),
- ),
+ array(
+ 'item_id' => 2,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413322,
+ 'notification_data' => array(),
+ ),
+ array(
+ 'item_id' => 4,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413324,
+ 'notification_data' => array(
+ 'poster_id' => 2,
+ 'topic_title' => 'test-title',
+ 'post_subject' => 'Re: test-title',
+ 'post_username' => '',
+ 'forum_id' => 2,
+ 'forum_name' => 'Your first forum',
+ ),
+ ),
+ array(
+ 'item_id' => 5,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413325,
+ 'notification_data' => array(
+ 'poster_id' => 2,
+ 'topic_title' => 'test-title2',
+ 'post_subject' => 'Re: test-title2',
+ 'post_username' => '',
+ 'forum_id' => 3,
+ 'forum_name' => 'Your second forum',
+ ),
+ ),
+ )
);
-
- $this->assertEquals(sizeof($expected), $notifications['unread_count']);
-
- $notifications = $notifications['notifications'];
-
- foreach ($expected as $notification_id => $notification_data)
- {
- //echo $notifications[$notification_id];
-
- $this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
-
- foreach ($notification_data as $key => $value)
- {
- $this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
- }
- }
}
}
diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php
index 4e564ce23c..8597c626a4 100644
--- a/tests/notification/submit_post_base.php
+++ b/tests/notification/submit_post_base.php
@@ -53,7 +53,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
$db = $this->db;
// Auth
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$auth->expects($this->any())
->method('acl_get')
->with($this->stringContains('_'),
@@ -65,12 +65,12 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
)));
// Config
- $config = new phpbb_config(array('num_topics' => 1,'num_posts' => 1,));
+ $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(),
+ $cache = new \phpbb\cache\service(
+ new \phpbb\cache\driver\null(),
$config,
$db,
$phpbb_root_path,
@@ -81,7 +81,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
// User
- $user = $this->getMock('phpbb_user');
+ $user = $this->getMock('\phpbb\user');
$user->ip = '';
$user->data = array(
'user_id' => 2,
@@ -91,21 +91,21 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
);
// Request
- $type_cast_helper = $this->getMock('phpbb_request_type_cast_helper_interface');
- $request = $this->getMock('phpbb_request');
+ $type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface');
+ $request = $this->getMock('\phpbb\request\request');
// Container
$phpbb_container = new phpbb_mock_container_builder();
- $phpbb_container->set('content.visibility', new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
+ $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
- $user_loader = new phpbb_user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
+ $user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
// Notification Types
$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;
+ $class_name = '\phpbb\notification\type\\' . $type;
$class = new $class_name(
$user_loader, $db, $cache->get_driver(), $user, $auth, $config,
$phpbb_root_path, $phpEx,
@@ -117,7 +117,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
}
// Notification Manager
- $phpbb_notifications = new phpbb_notification_manager($notification_types_array, array(),
+ $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);