mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-13 20:28:44 +01:00
Merge pull request #2862 from marc1706/ticket/12932
[ticket/12932] Add method for allowing override of \phpbb\datetime class * marc1706/ticket/12932: [ticket/12932] Remove set_datetime_class method from user class [ticket/12932] Fix tests and calls to create_datetime [ticket/12932] Add method for getting the datetime class and allow overriding
This commit is contained in:
commit
54b0ebc410
2
phpBB/config/parameters.yml
Normal file
2
phpBB/config/parameters.yml
Normal file
@ -0,0 +1,2 @@
|
||||
parameters:
|
||||
datetime.class: \phpbb\datetime
|
@ -10,6 +10,7 @@ imports:
|
||||
- { resource: mimetype_guessers.yml }
|
||||
- { resource: passwords.yml }
|
||||
- { resource: profilefields.yml }
|
||||
- { resource: parameters.yml }
|
||||
|
||||
services:
|
||||
acl.permissions:
|
||||
@ -346,6 +347,8 @@ services:
|
||||
|
||||
user:
|
||||
class: phpbb\user
|
||||
arguments:
|
||||
- %datetime.class%
|
||||
|
||||
user_loader:
|
||||
class: phpbb\user_loader
|
||||
|
@ -1061,7 +1061,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
|
||||
foreach ($unsorted_timezones as $timezone)
|
||||
{
|
||||
$tz = new DateTimeZone($timezone);
|
||||
$dt = new \phpbb\datetime($user, 'now', $tz);
|
||||
$dt = $user->create_datetime('now', $tz);
|
||||
$offset = $dt->getOffset();
|
||||
$current_time = $dt->format($user->lang['DATETIME_FORMAT'], true);
|
||||
$offset_string = phpbb_format_timezone_offset($offset);
|
||||
@ -4881,7 +4881,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
|
||||
}
|
||||
}
|
||||
|
||||
$dt = new \phpbb\datetime($user, 'now', $user->timezone);
|
||||
$dt = $user->create_datetime();
|
||||
$timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset());
|
||||
$timezone_name = $user->timezone->getName();
|
||||
if (isset($user->lang['timezones'][$timezone_name]))
|
||||
|
@ -240,7 +240,7 @@ $sub = $request->variable('sub', '');
|
||||
// Set PHP error handler to ours
|
||||
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
|
||||
|
||||
$user = new \phpbb\user();
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$auth = new \phpbb\auth\auth();
|
||||
|
||||
// Add own hook handler, if present. :o
|
||||
|
@ -121,7 +121,7 @@ class soft_delete_mod_convert extends \phpbb\db\migration\migration
|
||||
new \phpbb\auth\auth(),
|
||||
$this->config,
|
||||
$this->db,
|
||||
new \phpbb\user(),
|
||||
new \phpbb\user('\phpbb\datetime'),
|
||||
$this->phpbb_root_path,
|
||||
$this->php_ext,
|
||||
$this->table_prefix . 'forums',
|
||||
|
@ -31,6 +31,11 @@ class user extends \phpbb\session
|
||||
*/
|
||||
public $timezone;
|
||||
|
||||
/**
|
||||
* @var string Class name of datetime object
|
||||
*/
|
||||
protected $datetime;
|
||||
|
||||
var $lang_name = false;
|
||||
var $lang_id = false;
|
||||
var $lang_path;
|
||||
@ -42,12 +47,14 @@ class user extends \phpbb\session
|
||||
|
||||
/**
|
||||
* Constructor to set the lang path
|
||||
* @param string $datetime_class Class name of datetime class
|
||||
*/
|
||||
function __construct()
|
||||
function __construct($datetime_class)
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
$this->lang_path = $phpbb_root_path . 'language/';
|
||||
$this->datetime = $datetime_class;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -727,7 +734,7 @@ class user extends \phpbb\session
|
||||
public function create_datetime($time = 'now', \DateTimeZone $timezone = null)
|
||||
{
|
||||
$timezone = $timezone ?: $this->timezone;
|
||||
return new \phpbb\datetime($this, $time, $timezone);
|
||||
return new $this->datetime($this, $time, $timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
|
||||
$db = $this->new_dbal();
|
||||
$config = new \phpbb\config\config(array());
|
||||
$this->request = $this->getMock('\phpbb\request\request');
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->user = new \phpbb\user('\phpbb\datetime');
|
||||
$driver_helper = new \phpbb\passwords\driver\helper($config);
|
||||
$passwords_drivers = array(
|
||||
'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),
|
||||
|
@ -39,7 +39,7 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
|
||||
'max_login_attempts' => 0,
|
||||
));
|
||||
$request = $this->getMock('\phpbb\request\request');
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$driver_helper = new \phpbb\passwords\driver\helper($config);
|
||||
$passwords_drivers = array(
|
||||
'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),
|
||||
|
@ -31,7 +31,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->user = new \phpbb\user('\phpbb\datetime');
|
||||
$this->service_name = 'auth.provider.oauth.service.testing';
|
||||
$this->token_storage_table = 'phpbb_oauth_tokens';
|
||||
|
||||
|
@ -266,7 +266,7 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
|
||||
|
||||
public function test_localize_errors()
|
||||
{
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$lang_array = array(
|
||||
array('FOOBAR_OFF', 'foobar_off'),
|
||||
array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'),
|
||||
|
@ -32,7 +32,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$this->user->method('lang')->will($this->returnArgument(0));
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
||||
set_config(null, null, null, $this->config);
|
||||
$this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db);
|
||||
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$this->user->method('lang')->will($this->returnArgument(0));
|
||||
|
||||
$this->task = new phpbb_cron_task_simple();
|
||||
|
@ -306,7 +306,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||
->will($this->returnValueMap(array(
|
||||
array('m_approve', 1, true),
|
||||
)));
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
|
||||
|
@ -134,7 +134,7 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data
|
||||
->method('acl_getf')
|
||||
->with($this->stringContains('_'), $this->anything())
|
||||
->will($this->returnValueMap($permissions));
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$config = new phpbb\config\config(array());
|
||||
$content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
|
||||
|
||||
|
@ -134,7 +134,7 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data
|
||||
->method('acl_getf')
|
||||
->with($this->stringContains('_'), $this->anything())
|
||||
->will($this->returnValueMap($permissions));
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$config = new phpbb\config\config(array());
|
||||
$content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
|
||||
|
||||
|
@ -81,7 +81,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
|
||||
->method('acl_get')
|
||||
->with($this->stringContains('_'), $this->anything())
|
||||
->will($this->returnValueMap($permissions));
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$config = new phpbb\config\config(array());
|
||||
$content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
|
||||
|
||||
|
@ -124,7 +124,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$config = new phpbb\config\config(array());
|
||||
$content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
|
||||
|
||||
@ -174,7 +174,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$config = new phpbb\config\config(array());
|
||||
$content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
|
||||
|
||||
|
@ -88,7 +88,7 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$config = new phpbb\config\config(array());
|
||||
$content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
|
||||
|
||||
|
@ -72,7 +72,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
|
||||
include(__DIR__.'/phpbb/controller/foo.php');
|
||||
}
|
||||
|
||||
$resolver = new \phpbb\controller\resolver(new \phpbb\user, $container, dirname(__FILE__) . '/');
|
||||
$resolver = new \phpbb\controller\resolver(new \phpbb\user('\phpbb\datetime'), $container, dirname(__FILE__) . '/');
|
||||
$symfony_request = new Request();
|
||||
$symfony_request->attributes->set('_controller', 'foo.controller:handle');
|
||||
|
||||
|
@ -20,7 +20,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
|
||||
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->user = new \phpbb\user('\phpbb\datetime');
|
||||
$phpbb_path_helper = new \phpbb\path_helper(
|
||||
new \phpbb\symfony_request(
|
||||
new phpbb_mock_request()
|
||||
|
@ -39,7 +39,7 @@ class phpbb_datetime_from_format_test extends phpbb_test_case
|
||||
{
|
||||
global $user;
|
||||
|
||||
$user = new \phpbb\user();
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->timezone = new DateTimeZone($timezone);
|
||||
$user->lang['datetime'] = array(
|
||||
'TODAY' => 'Today',
|
||||
|
@ -60,7 +60,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
||||
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$container->set('migrator', $migrator);
|
||||
$user = new \phpbb\user();
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
|
||||
$this->extension_manager = new \phpbb\extension\manager(
|
||||
$container,
|
||||
|
@ -32,7 +32,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
|
||||
|
||||
$db = $this->db = $this->new_dbal();
|
||||
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
|
||||
$user = $this->user = new \phpbb\user();
|
||||
$user = $this->user = new \phpbb\user('\phpbb\user');
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
|
@ -154,7 +154,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
|
||||
$phpbb_root_path = __DIR__ . './../../phpBB/';
|
||||
$php_ext = 'php';
|
||||
$table_prefix = 'phpbb_';
|
||||
$user = new \phpbb\user();
|
||||
$user = new \phpbb\user('\phpbb\user');
|
||||
|
||||
$migrator = new \phpbb\db\migrator(
|
||||
$config,
|
||||
|
@ -44,7 +44,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||
$this->db_tools = new \phpbb\db\tools($this->db);
|
||||
$this->phpbb_root_path = dirname(__FILE__) . '/';
|
||||
$this->phpEx = 'php';
|
||||
$this->user = new \phpbb\user();
|
||||
$this->user = new \phpbb\user('\phpbb\datetime');
|
||||
$this->table_prefix = 'phpbb_';
|
||||
|
||||
$this->template = new \phpbb\template\twig\twig(
|
||||
|
@ -22,7 +22,7 @@ class phpbb_generate_string_list_test extends phpbb_test_case
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->user = new \phpbb\user();
|
||||
$this->user = new \phpbb\user('\phpbb\datetime');
|
||||
$this->user->data = array('user_lang' => 'en');
|
||||
$this->user->add_lang('common');
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
if ($throws_exception)
|
||||
@ -55,7 +55,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\legend($db, $user);
|
||||
@ -95,7 +95,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\legend($db, $user);
|
||||
@ -183,7 +183,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\legend($db, $user);
|
||||
@ -238,7 +238,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\legend($db, $user);
|
||||
@ -293,7 +293,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\legend($db, $user);
|
||||
@ -391,7 +391,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\legend($db, $user);
|
||||
|
@ -39,7 +39,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
if ($throws_exception)
|
||||
@ -57,7 +57,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
|
||||
@ -141,7 +141,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
|
||||
@ -184,7 +184,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
|
||||
@ -251,7 +251,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
|
||||
@ -303,7 +303,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
|
||||
@ -466,7 +466,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
|
||||
@ -629,7 +629,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
|
||||
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array();
|
||||
|
||||
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
|
||||
|
@ -27,7 +27,7 @@ class phpbb_log_add_test extends phpbb_database_test_case
|
||||
$db = $this->new_dbal();
|
||||
$cache = new phpbb_mock_cache;
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
|
||||
$log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
@ -56,7 +56,7 @@ class phpbb_log_add_test extends phpbb_database_test_case
|
||||
$db = $this->new_dbal();
|
||||
$cache = new phpbb_mock_cache;
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
|
||||
$log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
|
@ -30,7 +30,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case
|
||||
|
||||
$db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->data['user_id'] = 1;
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
|
||||
|
@ -161,7 +161,7 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case
|
||||
$db = $this->new_dbal();
|
||||
$cache = new phpbb_mock_cache;
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
|
||||
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
|
@ -56,7 +56,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
|
||||
'allow_topic_notify' => true,
|
||||
'allow_forum_notify' => true,
|
||||
));
|
||||
$user = $this->user = new \phpbb\user();
|
||||
$user = $this->user = new \phpbb\user('\phpbb\datetime');
|
||||
$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(
|
||||
|
@ -85,7 +85,7 @@ 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');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$user->ip = '';
|
||||
$user->data = array(
|
||||
'user_id' => 2,
|
||||
|
@ -53,7 +53,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
|
||||
array('u_viewprofile', 1, false),
|
||||
)));
|
||||
|
||||
$user = new \phpbb\user();
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->data = array('user_lang' => 'en');
|
||||
$user->add_lang('common');
|
||||
|
||||
|
@ -29,7 +29,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||
global $phpbb_dispatcher;
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$this->user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
@ -25,7 +25,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
@ -25,7 +25,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$this->user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
@ -25,7 +25,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
@ -21,7 +21,7 @@ class phpbb_profilefield_type_googleplus_test extends phpbb_test_case
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$user = new \phpbb\user();
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->add_lang('ucp');
|
||||
$request = $this->getMock('\phpbb\request\request');
|
||||
$template = $this->getMock('\phpbb\template\template');
|
||||
|
@ -24,7 +24,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
@ -30,7 +30,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
|
||||
{
|
||||
global $request, $user, $cache;
|
||||
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$cache = new phpbb_mock_cache;
|
||||
$user->expects($this->any())
|
||||
->method('lang')
|
||||
|
@ -26,7 +26,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
@ -59,7 +59,7 @@ abstract class phpbb_security_test_base extends phpbb_test_case
|
||||
$phpbb_filesystem = new \phpbb\filesystem($symfony_request, $phpbb_root_path, $phpEx);
|
||||
|
||||
// Set no user and trick a bit to circumvent errors
|
||||
$user = new \phpbb\user();
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = true;
|
||||
$user->browser = $server['HTTP_USER_AGENT'];
|
||||
$user->referer = '';
|
||||
|
@ -65,7 +65,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||
|
||||
$defaults = $this->config_defaults();
|
||||
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
|
||||
$this->user = new \phpbb\user;
|
||||
$this->user = new \phpbb\user('\phpbb\datetime');
|
||||
|
||||
$path_helper = new \phpbb\path_helper(
|
||||
new \phpbb\symfony_request(
|
||||
|
@ -239,7 +239,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
);
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$container->set('migrator', $migrator);
|
||||
$user = new \phpbb\user();
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
|
||||
$extension_manager = new \phpbb\extension\manager(
|
||||
$container,
|
||||
@ -598,7 +598,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
|
||||
$db = $this->get_db();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
|
||||
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
@ -637,7 +637,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
|
||||
$db = $this->get_db();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->getMock('\phpbb\user');
|
||||
$user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
|
||||
$auth = $this->getMock('\phpbb\auth\auth');
|
||||
|
||||
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
|
@ -17,7 +17,7 @@ class phpbb_user_lang_test extends phpbb_test_case
|
||||
{
|
||||
public function test_user_lang_sprintf()
|
||||
{
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array(
|
||||
'FOO' => 'BAR',
|
||||
'BARZ' => 'PENG',
|
||||
@ -99,7 +99,7 @@ class phpbb_user_lang_test extends phpbb_test_case
|
||||
$this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post');
|
||||
|
||||
// ticket PHPBB3-10345 - different plural rules, not just 0/1/2+
|
||||
$user = new \phpbb\user;
|
||||
$user = new \phpbb\user('\phpbb\datetime');
|
||||
$user->lang = array(
|
||||
'PLURAL_RULE' => 13,
|
||||
'ARRY' => array(
|
||||
|
@ -33,7 +33,7 @@ class phpbb_version_helper_fetch_test extends phpbb_test_case
|
||||
new \phpbb\config\config(array(
|
||||
'version' => '3.1.0',
|
||||
)),
|
||||
new \phpbb\user()
|
||||
new \phpbb\user('\phpbb\datetime')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class phpbb_version_helper_test extends phpbb_test_case
|
||||
new \phpbb\config\config(array(
|
||||
'version' => '3.1.0',
|
||||
)),
|
||||
new \phpbb\user()
|
||||
new \phpbb\user('\phpbb\datetime')
|
||||
);
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ class phpbb_version_helper_test extends phpbb_test_case
|
||||
new \phpbb\config\config(array(
|
||||
'version' => $current_version,
|
||||
)),
|
||||
new \phpbb\user(),
|
||||
new \phpbb\user('\phpbb\datetime'),
|
||||
))
|
||||
->getMock()
|
||||
;
|
||||
@ -318,7 +318,7 @@ class phpbb_version_helper_test extends phpbb_test_case
|
||||
new \phpbb\config\config(array(
|
||||
'version' => $current_version,
|
||||
)),
|
||||
new \phpbb\user(),
|
||||
new \phpbb\user('\phpbb\datetime'),
|
||||
))
|
||||
->getMock()
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user