From 79d4ff553844fa80be4da9286239f62a45489072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Muller?= Date: Sun, 11 Jan 2015 17:32:31 +0100 Subject: [ticket/13494] Update calls to `set_config()` PHPBB3-13494 --- tests/notification/submit_post_base.php | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 5e770f71c9..fd5f33466b 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -70,7 +70,6 @@ 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( -- cgit v1.2.1 From a633f3484c63fe4bd70df548b3ae4bd569bdef46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Muller?= Date: Sun, 11 Jan 2015 18:01:52 +0100 Subject: [ticket/13496] Update calls to `set_config_count()` PHPBB3-13496 --- tests/notification/submit_post_base.php | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index fd5f33466b..2d621f82d3 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -70,7 +70,6 @@ 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_count(null, null, null, $config); $cache = new \phpbb\cache\service( new \phpbb\cache\driver\null(), -- cgit v1.2.1 From 179a4700221aa49071b07d638c44b9326c7a14a8 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Tue, 14 Apr 2015 02:31:23 +0200 Subject: [ticket/13762] Moving language related functionality into a separate class PHPBB3-13762 --- tests/notification/submit_post_base.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 2d621f82d3..1412fb8509 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -83,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, -- cgit v1.2.1 From b3cc20a575da12e7b66f3883dcc7f0eb6ca82ad8 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 4 May 2015 10:09:37 +0200 Subject: [ticket/13782] Rename null driver to dummy for PHP7 compatibility PHPBB3-13782 --- tests/notification/submit_post_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 1412fb8509..d7a711e007 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -72,7 +72,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $config = new \phpbb\config\config(array('num_topics' => 1,'num_posts' => 1,)); $cache = new \phpbb\cache\service( - new \phpbb\cache\driver\null(), + new \phpbb\cache\driver\dummy(), $config, $db, $phpbb_root_path, -- cgit v1.2.1 From f5ce9f273829ba470a1348b4314cddb58f552da0 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Sun, 3 May 2015 16:06:42 +0200 Subject: [ticket/13680] Updated quote notifications Added get_quote_authors() to text_formatter.utils service to retrieve the names used in first-level quotes PHPBB3-13680 --- tests/notification/submit_post_base.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index d7a711e007..04fb6658c3 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -117,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; -- cgit v1.2.1 From be0d4e20d4be8bc3217e5d025058e065b8f2071a Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Mon, 28 Apr 2014 14:00:27 +0200 Subject: [ticket/11444] Moving the in-board notifications to a method class Currently the in-board method for the notifications is hardcoded and cannot be disabled. This method should be in his own class extending `phpbb\notification\method\method_interface`. It also add the possibility, for each method, to be enabled by default (ie: no entry in the DB => notification enabled). https://tracker.phpbb.com/browse/PHPBB3-11444 https://tracker.phpbb.com/browse/PHPBB3-11967 PHPBB3-11444 --- tests/notification/submit_post_base.php | 61 ++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 17 deletions(-) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 04fb6658c3..73711369ed 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -50,7 +50,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; + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $request, $phpEx, $phpbb_root_path, $user_loader; // Database $this->db = $this->new_dbal(); @@ -69,7 +69,11 @@ 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,)); + $config = new \phpbb\config\config(array( + 'num_topics' => 1, + 'num_posts' => 1, + 'allow_board_notifications' => true, + )); $cache = new \phpbb\cache\service( new \phpbb\cache\driver\dummy(), @@ -111,30 +115,46 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $notification_types_array = array(); foreach ($notification_types as $type) { - $class_name = '\phpbb\notification\type\\' . $type; - $class = new $class_name( - $user_loader, $db, $cache->get_driver(), $user, $auth, $config, - $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); - + $class = $this->build_type($type); + $phpbb_container->set('notification.type.' . $type, array(array($this, 'build_type'), array($type))); $notification_types_array['notification.type.' . $type] = $class; } + // Methods Types + $class_name = 'phpbb\notification\method\board'; + $class = new $class_name( + $user_loader, $db, $cache->get_driver(), $user, $auth, $config, + $phpbb_root_path, $phpEx, + NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE); + $phpbb_container->set('notification.method.board', $class); + $notification_methods_array = array('notification.method.board' => $class); + // Notification Manager - $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(), + $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, $notification_methods_array, $phpbb_container, $user_loader, $config, $phpbb_dispatcher, $db, $cache, $user, $phpbb_root_path, $phpEx, - NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE); + NOTIFICATION_TYPES_TABLE, USER_NOTIFICATIONS_TABLE); $phpbb_container->set('notification_manager', $phpbb_notifications); } + public function build_type($type) + { + global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $request, $phpEx, $phpbb_root_path, $user_loader; + + $class_name = '\phpbb\notification\type\\' . $type; + $class = new $class_name( + $user_loader, $db, $cache->get_driver(), $user, $auth, $config, + $phpbb_root_path, $phpEx, + NOTIFICATION_TYPES_TABLE, USER_NOTIFICATIONS_TABLE); + + if ($type === 'quote') + { + $class->set_utils(new \phpbb\textformatter\s9e\utils); + } + + return $class; + } + /** * @dataProvider submit_post_data */ @@ -157,4 +177,11 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $this->assertEquals($expected_after, $this->db->sql_fetchrowset($result)); $this->db->sql_freeresult($result); } + + 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'); + } } -- cgit v1.2.1 From fc34057f288c6b8c656a0ed1ac2cb5a86f86206d Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 9 Jul 2015 17:04:40 +0200 Subject: [ticket/11444] Update tests and cleanup types/methods PHPBB3-11444 --- tests/notification/submit_post_base.php | 71 ++++++++++++++------------------- 1 file changed, 30 insertions(+), 41 deletions(-) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 73711369ed..72b25abf0a 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -11,6 +11,10 @@ * */ +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_posting.php'; @@ -75,8 +79,9 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c 'allow_board_notifications' => true, )); + $cache_driver = new \phpbb\cache\driver\dummy(); $cache = new \phpbb\cache\service( - new \phpbb\cache\driver\dummy(), + $cache_driver, $config, $db, $phpbb_root_path, @@ -103,58 +108,49 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $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_dispatcher = new phpbb_mock_event_dispatcher(); - $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $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); + // Container + $phpbb_container = new ContainerBuilder(); + $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures')); + $loader->load('services_notification.yml'); + $phpbb_container->set('user_loader', $user_loader); + $phpbb_container->set('user', $user); + $phpbb_container->set('config', $config); + $phpbb_container->set('dbal.conn', $db); + $phpbb_container->set('auth', $auth); + $phpbb_container->set('cache.driver', $cache_driver); + $phpbb_container->set('cache', $cache); + $phpbb_container->set('text_formatter.utils', new \phpbb\textformatter\s9e\utils()); + $phpbb_container->set('dispatcher', $phpbb_dispatcher); + $phpbb_container->setParameter('core.root_path', $phpbb_root_path); + $phpbb_container->setParameter('core.php_ext', $phpEx); + $phpbb_container->setParameter('tables.notifications', 'phpbb_notifications'); + $phpbb_container->setParameter('tables.user_notifications', 'phpbb_user_notifications'); + $phpbb_container->setParameter('tables.notification_types', 'phpbb_notification_types'); + $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE)); + $phpbb_container->compile(); + // Notification Types $notification_types = array('quote', 'bookmark', 'post', 'post_in_queue', 'topic', 'topic_in_queue', 'approve_topic', 'approve_post'); $notification_types_array = array(); foreach ($notification_types as $type) { - $class = $this->build_type($type); - $phpbb_container->set('notification.type.' . $type, array(array($this, 'build_type'), array($type))); + $class = $phpbb_container->get('notification.type.' . $type); $notification_types_array['notification.type.' . $type] = $class; } // Methods Types - $class_name = 'phpbb\notification\method\board'; - $class = new $class_name( - $user_loader, $db, $cache->get_driver(), $user, $auth, $config, - $phpbb_root_path, $phpEx, - NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE); - $phpbb_container->set('notification.method.board', $class); - $notification_methods_array = array('notification.method.board' => $class); + $notification_methods_array = array('notification.method.board' => $phpbb_container->get('notification.method.board')); // Notification Manager $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, $notification_methods_array, - $phpbb_container, $user_loader, $config, $phpbb_dispatcher, $db, $cache, $user, - $phpbb_root_path, $phpEx, + $phpbb_container, $user_loader, $phpbb_dispatcher, $db, $cache, $user, NOTIFICATION_TYPES_TABLE, USER_NOTIFICATIONS_TABLE); $phpbb_container->set('notification_manager', $phpbb_notifications); } - public function build_type($type) - { - global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $user, $request, $phpEx, $phpbb_root_path, $user_loader; - - $class_name = '\phpbb\notification\type\\' . $type; - $class = new $class_name( - $user_loader, $db, $cache->get_driver(), $user, $auth, $config, - $phpbb_root_path, $phpEx, - NOTIFICATION_TYPES_TABLE, USER_NOTIFICATIONS_TABLE); - - if ($type === 'quote') - { - $class->set_utils(new \phpbb\textformatter\s9e\utils); - } - - return $class; - } - /** * @dataProvider submit_post_data */ @@ -177,11 +173,4 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $this->assertEquals($expected_after, $this->db->sql_fetchrowset($result)); $this->db->sql_freeresult($result); } - - 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'); - } } -- cgit v1.2.1 From b64a37d451132dcf7ef5fc3d6e700a6fb6decd90 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Tue, 13 Oct 2015 23:40:52 -0700 Subject: [ticket/14237] Use $language class for notifications PHPBB3-14237 --- tests/notification/submit_post_base.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 72b25abf0a..14ca4499d2 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -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); } -- cgit v1.2.1 From 14e8113fcf01be7dbdb080458fcbf4e75668cc1a Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 31 Mar 2016 11:06:47 -0700 Subject: [ticket/14576] Move common required files to bootstrap PHPBB3-14576 --- tests/notification/submit_post_base.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'tests/notification/submit_post_base.php') diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 14ca4499d2..21559c42a5 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -15,10 +15,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_posting.php'; -require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; abstract class phpbb_notification_submit_post_base extends phpbb_database_test_case { -- cgit v1.2.1