mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-14 12:52:08 +02:00
Merge branch '3.3.x'
This commit is contained in:
commit
9ea5cfd14b
@ -445,7 +445,7 @@ class p_master
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!preg_match('#(?:' . implode(array_keys($valid_tokens), ')|(?:') . ')#', $token))
|
||||
if (!preg_match('#(?:' . implode(')|(?:', array_keys($valid_tokens)) . ')#', $token))
|
||||
{
|
||||
$token = '';
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ class bbcode_firstpass extends bbcode
|
||||
var $message = '';
|
||||
var $warn_msg = array();
|
||||
var $parsed_items = array();
|
||||
var $mode;
|
||||
|
||||
/**
|
||||
* Parse BBCode
|
||||
@ -1128,8 +1129,6 @@ class parse_message extends bbcode_firstpass
|
||||
var $allow_quote_bbcode = true;
|
||||
var $allow_url_bbcode = true;
|
||||
|
||||
var $mode;
|
||||
|
||||
/**
|
||||
* The plupload object used for dealing with attachments
|
||||
* @var \phpbb\plupload\plupload
|
||||
|
@ -255,6 +255,7 @@ class phpbb_bbcode_parser_test extends \phpbb_test_case
|
||||
$symfony_request = new \phpbb\symfony_request($request);
|
||||
|
||||
$bbcode = new bbcode_firstpass();
|
||||
$bbcode->mode = 'post';
|
||||
$bbcode->message = $message;
|
||||
$bbcode->bbcode_init(false);
|
||||
$bbcode->parse_bbcode();
|
||||
|
@ -121,6 +121,8 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
||||
|
||||
public function test_no_task()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$tasks = array(
|
||||
);
|
||||
|
||||
@ -161,6 +163,8 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
||||
|
||||
public function test_no_task_verbose()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$tasks = array(
|
||||
);
|
||||
|
||||
|
@ -112,7 +112,8 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $row['user_id'];
|
||||
$user_id = $row ? $row['user_id'] : null;
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
public function getInputStream($input)
|
||||
|
@ -287,7 +287,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||
*/
|
||||
public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum, $expected_user)
|
||||
{
|
||||
global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||
global $auth, $cache, $config, $db, $user, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||
|
||||
$config = new \phpbb\config\config(array(
|
||||
'num_posts' => 3,
|
||||
|
@ -74,7 +74,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
|
||||
protected function generate_route_objects()
|
||||
{
|
||||
global $request;
|
||||
global $request, $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->request = new phpbb_mock_request();
|
||||
$this->request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER);
|
||||
|
@ -79,6 +79,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
|
||||
$php_ini->expects($this->any())
|
||||
->method('getString')
|
||||
->willReturn($max_filesize);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $php_ini, $this->request);
|
||||
$type_form = new \phpbb\files\types\local($this->factory, $this->language, $php_ini, $this->request);
|
||||
$file = $this->getMockBuilder('\phpbb\files\filespec')
|
||||
->disableOriginalConstructor()
|
||||
@ -86,6 +87,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
|
||||
$file->expects($this->any())
|
||||
->method('get')
|
||||
->willReturn($filename);
|
||||
$type_form->set_upload($upload);
|
||||
$type_form->check_upload_size($file);
|
||||
|
||||
$this->assertSame($expected, $file->error);
|
||||
|
@ -161,6 +161,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
|
||||
global $config, $user, $auth, $phpbb_dispatcher;
|
||||
$config['load_online_guests'] = $display_guests;
|
||||
$user = new phpbb_mock_lang();
|
||||
$user->data['user_id'] = 100;
|
||||
$user->lang = $this->load_language();
|
||||
$auth = $this->createMock('\phpbb\auth\auth');
|
||||
$acl_get_map = array(
|
||||
|
@ -130,11 +130,13 @@ class phpbb_functions_validate_data_test extends phpbb_database_test_case
|
||||
*/
|
||||
public function test_validate_username($allow_name_chars, $expected)
|
||||
{
|
||||
global $cache, $config, $db;
|
||||
global $cache, $config, $db, $user;
|
||||
|
||||
$db = $this->db;
|
||||
$cache = $this->cache;
|
||||
$cache->put('_disallowed_usernames', array('barfoo'));
|
||||
$user = new phpbb_mock_user();
|
||||
$user->data['username_clean'] = 'username';
|
||||
|
||||
$config['allow_name_chars'] = $allow_name_chars;
|
||||
|
||||
|
@ -23,9 +23,14 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
global $cache, $config, $db, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path;
|
||||
global $cache, $config, $db, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx;
|
||||
|
||||
$db = $this->db = $this->new_dbal();
|
||||
|
||||
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
|
||||
$lang = new \phpbb\language\language($lang_loader);
|
||||
$user = new \phpbb\user($lang, '\phpbb\datetime');
|
||||
|
||||
$config = new \phpbb\config\config(array(
|
||||
'load_online_time' => 5,
|
||||
'search_type' => '\phpbb\search\fulltext_mysql',
|
||||
@ -62,16 +67,16 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
|
||||
array(
|
||||
'retain', false,
|
||||
array(
|
||||
array('post_id' => 1, 'poster_id' => ANONYMOUS, 'post_username' => ''),
|
||||
array('post_id' => 1, 'poster_id' => ANONYMOUS, 'post_username' => 'Guest'),
|
||||
array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'),
|
||||
array('post_id' => 3, 'poster_id' => ANONYMOUS, 'post_username' => ''),
|
||||
array('post_id' => 3, 'poster_id' => ANONYMOUS, 'post_username' => 'Guest'),
|
||||
array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'topic_id' => 1,
|
||||
'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => '', 'topic_first_poster_colour' => '',
|
||||
'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => '', 'topic_last_poster_colour' => '',
|
||||
'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Guest', 'topic_first_poster_colour' => '',
|
||||
'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Guest', 'topic_last_poster_colour' => '',
|
||||
),
|
||||
array(
|
||||
'topic_id' => 2,
|
||||
@ -80,8 +85,8 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
|
||||
),
|
||||
array(
|
||||
'topic_id' => 3,
|
||||
'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => '', 'topic_first_poster_colour' => '',
|
||||
'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => '', 'topic_last_poster_colour' => '',
|
||||
'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Guest', 'topic_first_poster_colour' => '',
|
||||
'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Guest', 'topic_last_poster_colour' => '',
|
||||
),
|
||||
array(
|
||||
'topic_id' => 4,
|
||||
@ -90,9 +95,9 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
|
||||
),
|
||||
),
|
||||
array(
|
||||
array('forum_id' => 1, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''),
|
||||
array('forum_id' => 1, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Guest', 'forum_last_poster_colour' => ''),
|
||||
array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''),
|
||||
array('forum_id' => 3, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''),
|
||||
array('forum_id' => 3, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Guest', 'forum_last_poster_colour' => ''),
|
||||
array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''),
|
||||
),
|
||||
),
|
||||
|
@ -131,6 +131,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes
|
||||
|
||||
$user = new phpbb_mock_user;
|
||||
$user->ip = '';
|
||||
$user->data['user_id'] = $user_id;
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
|
@ -22,7 +22,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher, $auth;
|
||||
global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher, $auth, $user;
|
||||
|
||||
$db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
|
@ -411,6 +411,8 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
|
||||
2 => 'plural (%d)',
|
||||
),
|
||||
);
|
||||
$user->session_id = false;
|
||||
$user->data['user_id'] = 10;
|
||||
|
||||
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
|
||||
|
@ -15,7 +15,7 @@ class get_callable_from_step_test extends phpbb_database_test_case
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $php_ext, $table_prefix, $phpbb_log;
|
||||
global $phpbb_root_path, $php_ext, $table_prefix, $phpbb_log, $user;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
@ -24,6 +24,7 @@ class get_callable_from_step_test extends phpbb_database_test_case
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$cache_service = $this->getMockBuilder('\phpbb\cache\service')->disableOriginalConstructor()->getMock();
|
||||
$user = $this->getMockBuilder('\phpbb\user')->disableOriginalConstructor()->getMock();
|
||||
$user->ip = '127.0.0.1';
|
||||
$module_manager = new \phpbb\module\module_manager(
|
||||
$this->getMockBuilder('\phpbb\cache\driver\dummy')->disableOriginalConstructor()->getMock(),
|
||||
$db,
|
||||
|
@ -26,6 +26,8 @@ class schema_generator_test extends phpbb_test_case
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->config = new \phpbb\config\config(array());
|
||||
@ -33,6 +35,8 @@ class schema_generator_test extends phpbb_test_case
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$this->db_tools = $factory->get($this->db);
|
||||
$this->table_prefix = 'phpbb_';
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $phpEx;
|
||||
}
|
||||
|
||||
protected function get_schema_generator(array $class_names)
|
||||
|
@ -44,8 +44,8 @@ class phpbb_passwords_helper_test extends \phpbb_test_case
|
||||
public function data_helper_encode64()
|
||||
{
|
||||
return array(
|
||||
array('foobar', 6, 'axqPW3aQ'),
|
||||
array('foobar', 7, 'axqPW3aQ..'),
|
||||
array('foobars', 6, 'axqPW3aQ'),
|
||||
array('foobarss', 7, 'axqPW3aQn/'),
|
||||
array('foobar', 5, 'axqPW34'),
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user