mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-09 02:06:32 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/softdelete-1-permission
* 'develop' of https://github.com/phpbb/phpbb3: (480 commits) [ticket/6723] Show info that message has been deleted before delivery [ticket/11385] Fix issue with migration module tool not getting extension module info [ticket/11386] Fix failing tests from constructor changes [ticket/11386] Fix circular reference error & serialize error [ticket/11386] Remove tests that check if finder cache is working [ticket/11386] Forgot to get the migration classes [ticket/11386] Update tests with new constructors for ext.manager/migrator [ticket/11386] Use finder to find migration files [ticket/11363] Fix to make get_module_infos get from all extensions [ticket/11381] Make finder able to search in all available extensions [ticket/11103] Revert whitespace changes [ticket/11103] Few more minor language things [ticket/11103] Don't call generate_board_url many times [ticket/11103] Case time in queries as an int [ticket/11103] Fix effectively installed check [ticket/11103] Remove padding from notifications for now. [ticket/11363] Fix a couple bugs and throw errors if the file not found [ticket/11372] Migrator should only check if effectively installed if not [ticket/11363] Load module info files for extensions too [ticket/11103] Notifications Migration file ... Conflicts: phpBB/includes/functions_posting.php phpBB/includes/mcp/mcp_queue.php phpBB/includes/search/fulltext_mysql.php phpBB/includes/search/fulltext_native.php phpBB/includes/search/fulltext_postgres.php phpBB/includes/search/fulltext_sphinx.php phpBB/install/database_update.php phpBB/styles/prosilver/template/ajax.js
This commit is contained in:
@@ -121,7 +121,11 @@ class phpbb_mock_cache implements phpbb_cache_driver_interface
|
||||
public function sql_load($query)
|
||||
{
|
||||
}
|
||||
public function sql_save($query, $query_result, $ttl)
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
|
||||
{
|
||||
return $query_result;
|
||||
}
|
||||
|
@@ -11,6 +11,9 @@ use Symfony\Component\DependencyInjection\ScopeInterface;
|
||||
|
||||
class phpbb_mock_container_builder implements ContainerInterface
|
||||
{
|
||||
protected $services = array();
|
||||
protected $parameters = array();
|
||||
|
||||
/**
|
||||
* Sets a service.
|
||||
*
|
||||
@@ -22,6 +25,7 @@ class phpbb_mock_container_builder implements ContainerInterface
|
||||
*/
|
||||
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
|
||||
{
|
||||
$this->services[$id] = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,6 +46,12 @@ class phpbb_mock_container_builder implements ContainerInterface
|
||||
*/
|
||||
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)
|
||||
{
|
||||
if ($this->has($id))
|
||||
{
|
||||
return $this->services[$id];
|
||||
}
|
||||
|
||||
throw new Exception('Could not find service: ' . $id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,6 +65,7 @@ class phpbb_mock_container_builder implements ContainerInterface
|
||||
*/
|
||||
public function has($id)
|
||||
{
|
||||
return isset($this->services[$id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +81,12 @@ class phpbb_mock_container_builder implements ContainerInterface
|
||||
*/
|
||||
public function getParameter($name)
|
||||
{
|
||||
if ($this->hasParameter($name))
|
||||
{
|
||||
return $this->parameters[$name];
|
||||
}
|
||||
|
||||
throw new Exception('Could not find parameter: ' . $name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,6 +100,7 @@ class phpbb_mock_container_builder implements ContainerInterface
|
||||
*/
|
||||
public function hasParameter($name)
|
||||
{
|
||||
return isset($this->parameters[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,6 +113,7 @@ class phpbb_mock_container_builder implements ContainerInterface
|
||||
*/
|
||||
public function setParameter($name, $value)
|
||||
{
|
||||
$this->parameters[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
94
tests/mock/notification_manager.php
Normal file
94
tests/mock/notification_manager.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?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_mock_notification_manager
|
||||
{
|
||||
public function load_notifications()
|
||||
{
|
||||
return array(
|
||||
'notifications' => array(),
|
||||
'unread_count' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
public function mark_notifications_read()
|
||||
{
|
||||
}
|
||||
|
||||
public function mark_notifications_read_by_parent()
|
||||
{
|
||||
}
|
||||
|
||||
public function mark_notifications_read_by_id()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function add_notifications()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function add_notifications_for_users()
|
||||
{
|
||||
}
|
||||
|
||||
public function update_notifications()
|
||||
{
|
||||
}
|
||||
|
||||
public function delete_notifications()
|
||||
{
|
||||
}
|
||||
|
||||
public function get_subscription_types()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function get_subscription_methods()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
public function get_global_subscriptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function add_subscription()
|
||||
{
|
||||
}
|
||||
|
||||
public function delete_subscription()
|
||||
{
|
||||
}
|
||||
|
||||
public function load_users()
|
||||
{
|
||||
}
|
||||
|
||||
public function get_user()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
40
tests/mock/notifications_auth.php
Normal file
40
tests/mock/notifications_auth.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_mock_notifications_auth extends phpbb_auth
|
||||
{
|
||||
function acl_get_list($user_id = false, $opts = false, $forum_id = false)
|
||||
{
|
||||
$user_id = (!is_array($user_id)) ? array($user_id) : $user_id;
|
||||
$opts = (!is_array($opts)) ? array($opts) : $opts;
|
||||
$forum_id = (!is_array($forum_id)) ? array($forum_id) : $forum_id;
|
||||
|
||||
$auth_list = array();
|
||||
|
||||
foreach ($forum_id as $fid)
|
||||
{
|
||||
foreach ($opts as $opt)
|
||||
{
|
||||
$auth_list[$fid][$opt] = array();
|
||||
|
||||
foreach ($user_id as $uid)
|
||||
{
|
||||
$auth_list[$fid][$opt][] = $uid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $auth_list;
|
||||
}
|
||||
|
||||
function acl_get($opt, $f = 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
69
tests/mock/notifications_notification_manager.php
Normal file
69
tests/mock/notifications_notification_manager.php
Normal file
@@ -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_mock_notifications_notification_manager 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user