[ticket/12932] Fix tests and calls to create_datetime

PHPBB3-12932
This commit is contained in:
Marc Alexander 2014-08-10 13:40:27 +02:00
parent a57a96cbdd
commit 8d99b4afe1
43 changed files with 64 additions and 64 deletions

View file

@ -1061,7 +1061,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
foreach ($unsorted_timezones as $timezone) foreach ($unsorted_timezones as $timezone)
{ {
$tz = new DateTimeZone($timezone); $tz = new DateTimeZone($timezone);
$dt = $user->create_datetime($user, 'now', $tz); $dt = $user->create_datetime('now', $tz);
$offset = $dt->getOffset(); $offset = $dt->getOffset();
$current_time = $dt->format($user->lang['DATETIME_FORMAT'], true); $current_time = $dt->format($user->lang['DATETIME_FORMAT'], true);
$offset_string = phpbb_format_timezone_offset($offset); $offset_string = phpbb_format_timezone_offset($offset);
@ -4881,7 +4881,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
} }
} }
$dt = $user->create_datetime($user, 'now', $user->timezone); $dt = $user->create_datetime();
$timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset()); $timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset());
$timezone_name = $user->timezone->getName(); $timezone_name = $user->timezone->getName();
if (isset($user->lang['timezones'][$timezone_name])) if (isset($user->lang['timezones'][$timezone_name]))

View file

@ -29,7 +29,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
$db = $this->new_dbal(); $db = $this->new_dbal();
$config = new \phpbb\config\config(array()); $config = new \phpbb\config\config(array());
$this->request = $this->getMock('\phpbb\request\request'); $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); $driver_helper = new \phpbb\passwords\driver\helper($config);
$passwords_drivers = array( $passwords_drivers = array(
'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),

View file

@ -39,7 +39,7 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
'max_login_attempts' => 0, 'max_login_attempts' => 0,
)); ));
$request = $this->getMock('\phpbb\request\request'); $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); $driver_helper = new \phpbb\passwords\driver\helper($config);
$passwords_drivers = array( $passwords_drivers = array(
'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),

View file

@ -31,7 +31,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
global $phpbb_root_path, $phpEx; global $phpbb_root_path, $phpEx;
$this->db = $this->new_dbal(); $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->service_name = 'auth.provider.oauth.service.testing';
$this->token_storage_table = 'phpbb_oauth_tokens'; $this->token_storage_table = 'phpbb_oauth_tokens';

View file

@ -266,7 +266,7 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
public function test_localize_errors() public function test_localize_errors()
{ {
$user = $this->getMock('\phpbb\user'); $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$lang_array = array( $lang_array = array(
array('FOOBAR_OFF', 'foobar_off'), array('FOOBAR_OFF', 'foobar_off'),
array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'), array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'),

View file

@ -32,7 +32,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
protected function setUp() 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)); $this->user->method('lang')->will($this->returnArgument(0));
} }

View file

@ -41,7 +41,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
set_config(null, null, null, $this->config); set_config(null, null, null, $this->config);
$this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); $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->user->method('lang')->will($this->returnArgument(0));
$this->task = new phpbb_cron_task_simple(); $this->task = new phpbb_cron_task_simple();

View file

@ -306,7 +306,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
->will($this->returnValueMap(array( ->will($this->returnValueMap(array(
array('m_approve', 1, true), array('m_approve', 1, true),
))); )));
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();

View file

@ -134,7 +134,7 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data
->method('acl_getf') ->method('acl_getf')
->with($this->stringContains('_'), $this->anything()) ->with($this->stringContains('_'), $this->anything())
->will($this->returnValueMap($permissions)); ->will($this->returnValueMap($permissions));
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$config = new phpbb\config\config(array()); $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); $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);

View file

@ -134,7 +134,7 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data
->method('acl_getf') ->method('acl_getf')
->with($this->stringContains('_'), $this->anything()) ->with($this->stringContains('_'), $this->anything())
->will($this->returnValueMap($permissions)); ->will($this->returnValueMap($permissions));
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$config = new phpbb\config\config(array()); $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); $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);

View file

@ -81,7 +81,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
->method('acl_get') ->method('acl_get')
->with($this->stringContains('_'), $this->anything()) ->with($this->stringContains('_'), $this->anything())
->will($this->returnValueMap($permissions)); ->will($this->returnValueMap($permissions));
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$config = new phpbb\config\config(array()); $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); $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);

View file

@ -124,7 +124,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$auth = $this->getMock('\phpbb\auth\auth'); $auth = $this->getMock('\phpbb\auth\auth');
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$config = new phpbb\config\config(array()); $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); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$auth = $this->getMock('\phpbb\auth\auth'); $auth = $this->getMock('\phpbb\auth\auth');
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$config = new phpbb\config\config(array()); $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); $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);

View file

@ -88,7 +88,7 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$auth = $this->getMock('\phpbb\auth\auth'); $auth = $this->getMock('\phpbb\auth\auth');
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$config = new phpbb\config\config(array()); $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); $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);

View file

@ -72,7 +72,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
include(__DIR__.'/phpbb/controller/foo.php'); 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 = new Request();
$symfony_request->attributes->set('_controller', 'foo.controller:handle'); $symfony_request->attributes->set('_controller', 'foo.controller:handle');

View file

@ -20,7 +20,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
global $phpbb_dispatcher, $phpbb_root_path, $phpEx; global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher; $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( $phpbb_path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request( new \phpbb\symfony_request(
new phpbb_mock_request() new phpbb_mock_request()

View file

@ -39,7 +39,7 @@ class phpbb_datetime_from_format_test extends phpbb_test_case
{ {
global $user; global $user;
$user = new \phpbb\user(); $user = new \phpbb\user('\phpbb\datetime');
$user->timezone = new DateTimeZone($timezone); $user->timezone = new DateTimeZone($timezone);
$user->lang['datetime'] = array( $user->lang['datetime'] = array(
'TODAY' => 'Today', 'TODAY' => 'Today',

View file

@ -60,7 +60,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder(); $container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator); $container->set('migrator', $migrator);
$user = new \phpbb\user(); $user = new \phpbb\user('\phpbb\datetime');
$this->extension_manager = new \phpbb\extension\manager( $this->extension_manager = new \phpbb\extension\manager(
$container, $container,

View file

@ -32,7 +32,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
$db = $this->db = $this->new_dbal(); $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); $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; $cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();

View file

@ -154,7 +154,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$phpbb_root_path = __DIR__ . './../../phpBB/'; $phpbb_root_path = __DIR__ . './../../phpBB/';
$php_ext = 'php'; $php_ext = 'php';
$table_prefix = 'phpbb_'; $table_prefix = 'phpbb_';
$user = new \phpbb\user(); $user = new \phpbb\user('\phpbb\user');
$migrator = new \phpbb\db\migrator( $migrator = new \phpbb\db\migrator(
$config, $config,

View file

@ -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->db_tools = new \phpbb\db\tools($this->db);
$this->phpbb_root_path = dirname(__FILE__) . '/'; $this->phpbb_root_path = dirname(__FILE__) . '/';
$this->phpEx = 'php'; $this->phpEx = 'php';
$this->user = new \phpbb\user(); $this->user = new \phpbb\user('\phpbb\datetime');
$this->table_prefix = 'phpbb_'; $this->table_prefix = 'phpbb_';
$this->template = new \phpbb\template\twig\twig( $this->template = new \phpbb\template\twig\twig(

View file

@ -22,7 +22,7 @@ class phpbb_generate_string_list_test extends phpbb_test_case
{ {
parent::setUp(); parent::setUp();
$this->user = new \phpbb\user(); $this->user = new \phpbb\user('\phpbb\datetime');
$this->user->data = array('user_lang' => 'en'); $this->user->data = array('user_lang' => 'en');
$this->user->add_lang('common'); $this->user->add_lang('common');
} }

View file

@ -37,7 +37,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
if ($throws_exception) if ($throws_exception)
@ -55,7 +55,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user); $test_class = new \phpbb\groupposition\legend($db, $user);

View file

@ -39,7 +39,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
if ($throws_exception) if ($throws_exception)
@ -57,7 +57,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $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; $cache = new phpbb_mock_cache;
$db = $this->new_dbal(); $db = $this->new_dbal();
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(); $user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache); $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);

View file

@ -27,7 +27,7 @@ class phpbb_log_add_test extends phpbb_database_test_case
$db = $this->new_dbal(); $db = $this->new_dbal();
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$auth = $this->getMock('\phpbb\auth\auth'); $auth = $this->getMock('\phpbb\auth\auth');
$log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $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(); $db = $this->new_dbal();
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$auth = $this->getMock('\phpbb\auth\auth'); $auth = $this->getMock('\phpbb\auth\auth');
$log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);

View file

@ -30,7 +30,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case
$db = $this->new_dbal(); $db = $this->new_dbal();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = $this->getMock('\phpbb\user'); $user = new \phpbb\user('\phpbb\datetime');
$user->data['user_id'] = 1; $user->data['user_id'] = 1;
$auth = $this->getMock('\phpbb\auth\auth'); $auth = $this->getMock('\phpbb\auth\auth');

View file

@ -161,7 +161,7 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case
$db = $this->new_dbal(); $db = $this->new_dbal();
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $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'); $auth = $this->getMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);

View file

@ -56,7 +56,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
'allow_topic_notify' => true, 'allow_topic_notify' => true,
'allow_forum_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'); $this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
$auth = $this->auth = new phpbb_mock_notifications_auth(); $auth = $this->auth = new phpbb_mock_notifications_auth();
$cache = $this->cache = new \phpbb\cache\service( $cache = $this->cache = new \phpbb\cache\service(

View file

@ -85,7 +85,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
// User // User
$user = $this->getMock('\phpbb\user'); $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->ip = ''; $user->ip = '';
$user->data = array( $user->data = array(
'user_id' => 2, 'user_id' => 2,

View file

@ -53,7 +53,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
array('u_viewprofile', 1, false), array('u_viewprofile', 1, false),
))); )));
$user = new \phpbb\user(); $user = new \phpbb\user('\phpbb\datetime');
$user->data = array('user_lang' => 'en'); $user->data = array('user_lang' => 'en');
$user->add_lang('common'); $user->add_lang('common');

View file

@ -29,7 +29,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
global $phpbb_dispatcher; global $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_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()) $this->user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -25,7 +25,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
*/ */
public function setUp() public function setUp()
{ {
$user = $this->getMock('\phpbb\user'); $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->expects($this->any()) $user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -25,7 +25,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
*/ */
public function setUp() public function setUp()
{ {
$this->user = $this->getMock('\phpbb\user'); $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$this->user->expects($this->any()) $this->user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -25,7 +25,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
*/ */
public function setUp() public function setUp()
{ {
$user = $this->getMock('\phpbb\user'); $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->expects($this->any()) $user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -21,7 +21,7 @@ class phpbb_profilefield_type_googleplus_test extends phpbb_test_case
{ {
parent::setUp(); parent::setUp();
$user = new \phpbb\user(); $user = new \phpbb\user('\phpbb\datetime');
$user->add_lang('ucp'); $user->add_lang('ucp');
$request = $this->getMock('\phpbb\request\request'); $request = $this->getMock('\phpbb\request\request');
$template = $this->getMock('\phpbb\template\template'); $template = $this->getMock('\phpbb\template\template');

View file

@ -24,7 +24,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
*/ */
public function setUp() public function setUp()
{ {
$user = $this->getMock('\phpbb\user'); $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->expects($this->any()) $user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -30,7 +30,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
{ {
global $request, $user, $cache; global $request, $user, $cache;
$user = $this->getMock('\phpbb\user'); $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$user->expects($this->any()) $user->expects($this->any())
->method('lang') ->method('lang')

View file

@ -26,7 +26,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
*/ */
public function setUp() public function setUp()
{ {
$user = $this->getMock('\phpbb\user'); $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->expects($this->any()) $user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -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); $phpbb_filesystem = new \phpbb\filesystem($symfony_request, $phpbb_root_path, $phpEx);
// Set no user and trick a bit to circumvent errors // Set no user and trick a bit to circumvent errors
$user = new \phpbb\user(); $user = new \phpbb\user('\phpbb\datetime');
$user->lang = true; $user->lang = true;
$user->browser = $server['HTTP_USER_AGENT']; $user->browser = $server['HTTP_USER_AGENT'];
$user->referer = ''; $user->referer = '';

View file

@ -65,7 +65,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
$defaults = $this->config_defaults(); $defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config)); $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( $path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request( new \phpbb\symfony_request(

View file

@ -239,7 +239,7 @@ class phpbb_functional_test_case extends phpbb_test_case
); );
$container = new phpbb_mock_container_builder(); $container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator); $container->set('migrator', $migrator);
$user = new \phpbb\user(); $user = new \phpbb\user('\phpbb\datetime');
$extension_manager = new \phpbb\extension\manager( $extension_manager = new \phpbb\extension\manager(
$container, $container,
@ -598,7 +598,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$db = $this->get_db(); $db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $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'); $auth = $this->getMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $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(); $db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $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'); $auth = $this->getMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);

View file

@ -17,7 +17,7 @@ class phpbb_user_lang_test extends phpbb_test_case
{ {
public function test_user_lang_sprintf() public function test_user_lang_sprintf()
{ {
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array( $user->lang = array(
'FOO' => 'BAR', 'FOO' => 'BAR',
'BARZ' => 'PENG', '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'); $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post');
// ticket PHPBB3-10345 - different plural rules, not just 0/1/2+ // ticket PHPBB3-10345 - different plural rules, not just 0/1/2+
$user = new \phpbb\user; $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array( $user->lang = array(
'PLURAL_RULE' => 13, 'PLURAL_RULE' => 13,
'ARRY' => array( 'ARRY' => array(

View file

@ -33,7 +33,7 @@ class phpbb_version_helper_fetch_test extends phpbb_test_case
new \phpbb\config\config(array( new \phpbb\config\config(array(
'version' => '3.1.0', 'version' => '3.1.0',
)), )),
new \phpbb\user() new \phpbb\user('\phpbb\datetime')
); );
} }

View file

@ -30,7 +30,7 @@ class phpbb_version_helper_test extends phpbb_test_case
new \phpbb\config\config(array( new \phpbb\config\config(array(
'version' => '3.1.0', '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( new \phpbb\config\config(array(
'version' => $current_version, 'version' => $current_version,
)), )),
new \phpbb\user(), new \phpbb\user('\phpbb\datetime'),
)) ))
->getMock() ->getMock()
; ;
@ -318,7 +318,7 @@ class phpbb_version_helper_test extends phpbb_test_case
new \phpbb\config\config(array( new \phpbb\config\config(array(
'version' => $current_version, 'version' => $current_version,
)), )),
new \phpbb\user(), new \phpbb\user('\phpbb\datetime'),
)) ))
->getMock() ->getMock()
; ;