mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-03 23:37:39 +02:00
[ticket/14237] Use $language class for notifications
PHPBB3-14237
This commit is contained in:
@@ -21,11 +21,12 @@ if (!defined('IN_PHPBB'))
|
||||
|
||||
class phpbb_mock_notification_type_post extends \phpbb\notification\type\post
|
||||
{
|
||||
public function __construct($user_loader, $db, $cache, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $user_notifications_table)
|
||||
public function __construct($user_loader, $db, $cache, $language, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $user_notifications_table)
|
||||
{
|
||||
$this->user_loader = $user_loader;
|
||||
$this->db = $db;
|
||||
$this->cache = $cache;
|
||||
$this->language = $language;
|
||||
$this->user = $user;
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
|
@@ -90,6 +90,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
|
||||
$loader->load('services_notification.yml');
|
||||
$phpbb_container->set('user_loader', $this->user_loader);
|
||||
$phpbb_container->set('user', $user);
|
||||
$phpbb_container->set('language', $lang);
|
||||
$phpbb_container->set('config', $this->config);
|
||||
$phpbb_container->set('dbal.conn', $this->db);
|
||||
$phpbb_container->set('auth', $auth);
|
||||
@@ -111,6 +112,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
|
||||
$this->phpbb_dispatcher,
|
||||
$this->db,
|
||||
$this->cache,
|
||||
$lang,
|
||||
$this->user,
|
||||
'phpbb_notification_types',
|
||||
'phpbb_user_notifications'
|
||||
|
@@ -17,6 +17,9 @@ services:
|
||||
dbal.conn:
|
||||
synthetic: true
|
||||
|
||||
language:
|
||||
synthetic: true
|
||||
|
||||
auth:
|
||||
synthetic: true
|
||||
|
||||
|
@@ -54,7 +54,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $request, $phpEx, $phpbb_root_path, $user_loader;
|
||||
global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $lang, $user, $request, $phpEx, $phpbb_root_path, $user_loader;
|
||||
|
||||
// Database
|
||||
$this->db = $this->new_dbal();
|
||||
@@ -91,9 +91,12 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
|
||||
// Event dispatcher
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
|
||||
// Language
|
||||
$lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
|
||||
// User
|
||||
$user = $this->getMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
$lang,
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user->ip = '';
|
||||
@@ -117,6 +120,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
|
||||
$loader->load('services_notification.yml');
|
||||
$phpbb_container->set('user_loader', $user_loader);
|
||||
$phpbb_container->set('user', $user);
|
||||
$phpbb_container->set('language', $lang);
|
||||
$phpbb_container->set('config', $config);
|
||||
$phpbb_container->set('dbal.conn', $db);
|
||||
$phpbb_container->set('auth', $auth);
|
||||
@@ -146,7 +150,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
|
||||
|
||||
// Notification Manager
|
||||
$phpbb_notifications = new \phpbb\notification\manager($notification_types_array, $notification_methods_array,
|
||||
$phpbb_container, $user_loader, $phpbb_dispatcher, $db, $cache, $user,
|
||||
$phpbb_container, $user_loader, $phpbb_dispatcher, $db, $cache, $lang, $user,
|
||||
NOTIFICATION_TYPES_TABLE, USER_NOTIFICATIONS_TABLE);
|
||||
$phpbb_container->set('notification_manager', $phpbb_notifications);
|
||||
}
|
||||
|
@@ -55,13 +55,13 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
|
||||
$lang = new \phpbb\language\language($lang_loader);
|
||||
$user = new \phpbb\user($lang, '\phpbb\datetime');
|
||||
$user->data = array('user_lang' => 'en');
|
||||
$user->add_lang('common');
|
||||
$lang->add_lang('common');
|
||||
|
||||
$user_loader = new phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
|
||||
$user_loader->load_users(array(2, 3, 4, 5, 6));
|
||||
|
||||
$this->notification = new phpbb_mock_notification_type_post(
|
||||
$user_loader, null, null, $user, null, null, $phpbb_root_path, $phpEx, null, null
|
||||
$user_loader, null, null, $lang, $user, null, null, $phpbb_root_path, $phpEx, null, null
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user