db = $this->new_dbal(); $config = $this->config = new phpbb_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'); } }