aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mock
diff options
context:
space:
mode:
authorNicofuma <github@nicofuma.fr>2014-04-28 14:00:27 +0200
committerTristan Darricau <tristan.darricau@sensiolabs.com>2015-07-13 22:41:13 +0200
commitbe0d4e20d4be8bc3217e5d025058e065b8f2071a (patch)
tree557a9732223835282b86ba8986120d978bca5260 /tests/mock
parent58d1d37c167c978257c9a4680d56835c63202738 (diff)
downloadforums-be0d4e20d4be8bc3217e5d025058e065b8f2071a.tar
forums-be0d4e20d4be8bc3217e5d025058e065b8f2071a.tar.gz
forums-be0d4e20d4be8bc3217e5d025058e065b8f2071a.tar.bz2
forums-be0d4e20d4be8bc3217e5d025058e065b8f2071a.tar.xz
forums-be0d4e20d4be8bc3217e5d025058e065b8f2071a.zip
[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
Diffstat (limited to 'tests/mock')
-rw-r--r--tests/mock/container_builder.php10
-rw-r--r--tests/mock/notification_manager.php7
-rw-r--r--tests/mock/notification_type_post.php5
3 files changed, 14 insertions, 8 deletions
diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php
index 297e3a65e6..e04a83804d 100644
--- a/tests/mock/container_builder.php
+++ b/tests/mock/container_builder.php
@@ -52,7 +52,15 @@ class phpbb_mock_container_builder implements ContainerInterface
{
if ($this->has($id))
{
- return $this->services[$id];
+ $service = $this->services[$id];
+ if (is_array($service) && is_callable($service[0]))
+ {
+ return call_user_func_array($service[0], $service[1]);
+ }
+ else
+ {
+ return $service;
+ }
}
throw new Exception('Could not find service: ' . $id);
diff --git a/tests/mock/notification_manager.php b/tests/mock/notification_manager.php
index 6a590bc0ca..952c0db489 100644
--- a/tests/mock/notification_manager.php
+++ b/tests/mock/notification_manager.php
@@ -32,19 +32,18 @@ class phpbb_mock_notification_manager
);
}
- public function mark_notifications_read()
+ public function mark_notifications()
{
}
- public function mark_notifications_read_by_parent()
+ public function mark_notifications_by_parent()
{
}
- public function mark_notifications_read_by_id()
+ public function mark_notifications_by_id()
{
}
-
public function add_notifications()
{
return array();
diff --git a/tests/mock/notification_type_post.php b/tests/mock/notification_type_post.php
index 6d8f6dc504..fd2d1b63cd 100644
--- a/tests/mock/notification_type_post.php
+++ b/tests/mock/notification_type_post.php
@@ -21,7 +21,7 @@ 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, $notifications_table, $user_notifications_table)
+ public function __construct($user_loader, $db, $cache, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $user_notifications_table)
{
$this->user_loader = $user_loader;
$this->db = $db;
@@ -34,7 +34,6 @@ class phpbb_mock_notification_type_post extends \phpbb\notification\type\post
$this->php_ext = $php_ext;
$this->notification_types_table = $notification_types_table;
- $this->notifications_table = $notifications_table;
- $this->user_notifications_table = $user_notifications_table;
+ $this->user_notifications_table = $user_notifications_table;
}
}