diff options
author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-04-29 22:16:46 -0500 |
---|---|---|
committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-04-29 22:16:46 -0500 |
commit | 4cd0914f8976913de0ec46cc78c8ac5731415838 (patch) | |
tree | bfc2f8d8334d8d9175cb8e493b66cdb46752231e /tests/notification/manager_helper.php | |
parent | 7bda5a016a726711855fb7a749f9f3638e63d1e3 (diff) | |
download | forums-4cd0914f8976913de0ec46cc78c8ac5731415838.tar forums-4cd0914f8976913de0ec46cc78c8ac5731415838.tar.gz forums-4cd0914f8976913de0ec46cc78c8ac5731415838.tar.bz2 forums-4cd0914f8976913de0ec46cc78c8ac5731415838.tar.xz forums-4cd0914f8976913de0ec46cc78c8ac5731415838.zip |
[ticket/11413] Fix notification tests
Send types/methods the cache service, not the driver (not sure why the
driver was sent before)
PHPBB3-11413
Diffstat (limited to 'tests/notification/manager_helper.php')
-rw-r--r-- | tests/notification/manager_helper.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php new file mode 100644 index 0000000000..8d2ce5e002 --- /dev/null +++ b/tests/notification/manager_helper.php @@ -0,0 +1,69 @@ +<?php +/** +* +* @package notifications +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Notifications service class +* @package notifications +*/ +class phpbb_notification_manager_helper extends phpbb_notification_manager +{ + public function set_var($name, $value) + { + $this->$name = $value; + } + + // Extra dependencies for get_*_class functions + protected $auth = null; + protected $cache = null; + protected $config = null; + public function setDependencies($auth, $cache, $config) + { + $this->auth = $auth; + $this->cache = $cache; + $this->config = $config; + } + + /** + * Helper to get the notifications item type class and set it up + */ + public function get_item_type_class($item_type, $data = array()) + { + $item_type = 'phpbb_notification_type_' . $item_type; + + $item = new $item_type($this->user_loader, $this->db, $this->cache, $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table); + + $item->set_notification_manager($this); + + $item->set_initial_data($data); + + return $item; + } + + /** + * Helper to get the notifications method class and set it up + */ + public function get_method_class($method_name) + { + $method_name = 'phpbb_notification_method_' . $method_name; + + $method = new $method_name($this->user_loader, $this->db, $this->cache, $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table); + + $method->set_notification_manager($this); + + return $method; + } +} |