@@ -154,7 +140,7 @@
{ICON_MOVE_UP}
{ICON_MOVE_DOWN_DISABLED}
{ICON_MOVE_DOWN}
- {ICON_EDIT}
+ {ICON_EDIT}
{ICON_DELETE}
@@ -173,7 +159,7 @@
-
+
-
+
TIME TAKEN : ".$timetaken_sec."s
\n";
+ print "TIME TAKEN : ".$timetaken_sec."s
\n";
print "\nBack to the overview page\n";
}
@@ -127,38 +127,38 @@ function filldb($newposts)
{
global $nr_of_forums;
global $nr_of_users;
-
+
$forum_topic_counts = array();
-
+
for ($i = 1; $i <= $nr_of_forums; $i++)
{
$forum_topic_counts[$i] = get_topic_count($i);
}
-
+
for($i = 0; $i < $newposts; $i++)
{
$userid = rand(2, $nr_of_users - 1);
$forum = rand(1,$nr_of_forums);
-
- if ((rand(0,30) < 1) || ($forum_topic_count[$forum] == 0))
+
+ if ((rand(0,30) < 1) || ($forum_topic_counts[$forum] == 0))
{
// create a new topic 1 in 30 times (or when there are none);
make_topic($userid, "Testing topic $i", $forum);
- $forum_topic_count[$forum]++;
- }
- else
+ $forum_topic_counts[$forum]++;
+ }
+ else
{
// Otherwise create a reply(posting) somewhere.
$topic = get_smallest_topic($forum);
create_posting($userid, $topic, $forum, "reply");
}
-
+
if (($i % 1000) == 0)
{
echo "status: $i
";
flush();
}
-
+
}
}
@@ -166,7 +166,7 @@ function filldb($newposts)
function get_smallest_topic($forum_id)
{
global $db;
-
+
$sql = "SELECT topic_id
FROM " . TOPICS_TABLE . "
WHERE (forum_id = $forum_id)
@@ -184,14 +184,14 @@ function get_smallest_topic($forum_id)
{
message_die(GENERAL_ERROR, "Couldn't get smallest topic.", "", __LINE__, __FILE__, $sql);
}
-
+
}
function get_topic_count($forum_id)
{
global $db;
-
+
$sql = "SELECT forum_topics_approved
FROM " . FORUMS_TABLE . "
WHERE (forum_id = $forum_id)";
@@ -208,7 +208,7 @@ function get_topic_count($forum_id)
{
message_die(GENERAL_ERROR, "Couldn't get topic count.", "", __LINE__, __FILE__, $sql);
}
-
+
}
@@ -218,7 +218,7 @@ function make_topic($user_id, $subject, $forum_id)
$topic_type = POST_NORMAL;
$topic_vote = 0;
$current_time = time();
-
+
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote)
VALUES ('$subject', $user_id, $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)";
@@ -230,9 +230,9 @@ function make_topic($user_id, $subject, $forum_id)
{
message_die(GENERAL_ERROR, "Error inserting data into topics table", "", __LINE__, __FILE__, $sql);
}
-
+
create_posting($user_id, $new_topic_id, $forum_id);
-
+
return $new_topic_id;
}
@@ -258,19 +258,19 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
$smilies_on = 1;
$attach_sig = 1;
$bbcode_uid = make_bbcode_uid();
-
+
$post_subject = 'random subject';
-
- $post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
-
+
+ $post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
+
$sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, attach_id, icon_id, post_username, post_time, poster_ip, post_visibility, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig, post_subject, post_text)
VALUES ($new_topic_id, $forum_id, $user_id, 0, 0, '$post_username', $current_time, '$user_ip', 1, '$bbcode_uid', $bbcode_on, $html_on, $smilies_on, $attach_sig, '$post_subject', '$post_message')";
$result = $db->sql_query($sql);
-
+
if ($result)
{
$new_post_id = $db->sql_nextid();
-
+
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_last_post_id = $new_post_id";
if($mode == "reply")
@@ -288,13 +288,13 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
$sql .= ", forum_topics_approved = forum_topics_approved + 1";
}
$sql .= " WHERE forum_id = $forum_id";
-
+
if($db->sql_query($sql))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts + 1
WHERE user_id = " . $user_id;
-
+
if($db->sql_query($sql, END_TRANSACTION))
{
// SUCCESS.
@@ -325,7 +325,7 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
else
{
message_die(GENERAL_ERROR, "Error inserting data into posts table", "", __LINE__, __FILE__, $sql);
- }
+ }
}
@@ -334,9 +334,10 @@ function generatepost($size=850)
global $bigass_text;
// Returns a string with a length between $size and $size*0.2
$size = rand(0.2*$size, $size);
-
+
$textsize = strlen($bigass_text);
$currentsize = 0;
+ $message = '';
// Add whole $text multiple times
while($currentsize < $size && $size-$currentsize <= $textsize)
{
@@ -348,8 +349,8 @@ function generatepost($size=850)
return (addslashes($message));
}
-
-
+
+
function nrof($table)
{
global $db;
@@ -417,9 +418,9 @@ function make_user($username)
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_attachsig, user_allowsmilies, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, ";
-
+
$sql .= "1, '')";
-
+
if($result = $db->sql_query($sql, BEGIN_TRANSACTION))
{
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_description, group_single_user, group_moderator)
@@ -430,7 +431,7 @@ function make_user($username)
VALUES ($new_user_id, $new_group_id, 0)";
if($result = $db->sql_query($sql, END_TRANSACTION))
{
-
+
// SUCCESS.
return true;
}
diff --git a/phpBB/develop/imageset_to_css.php b/phpBB/develop/imageset_to_css.php
index bbe7c31c83..c25e414320 100644
--- a/phpBB/develop/imageset_to_css.php
+++ b/phpBB/develop/imageset_to_css.php
@@ -2,7 +2,7 @@
/*
Converts imageset to CSS code
-
+
Change style name and path below, open in browser.
*/
@@ -145,8 +145,6 @@ for ($i=0; $isql_query($sql);
-$sql = "CREATE TABLE {$table_prefix}posts
- SELECT p.*, pt.post_subject, pt.post_text, pt.post_checksum, pt.bbcode_bitfield, pt.bbcode_uid
- FROM {$table_prefix}posts_temp p, {$table_prefix}posts_text pt
+$sql = "CREATE TABLE {$table_prefix}posts
+ SELECT p.*, pt.post_subject, pt.post_text, pt.post_checksum, pt.bbcode_bitfield, pt.bbcode_uid
+ FROM {$table_prefix}posts_temp p, {$table_prefix}posts_text pt
WHERE pt.post_id = p.post_id";
$db->sql_query($sql);
@@ -50,13 +50,13 @@ switch ($db->get_sql_layer())
{
case 'mysql':
case 'mysql4':
- $sql = 'ALTER TABLE ' . $table_prefix . 'posts
- ADD PRIMARY KEY (post_id),
- ADD INDEX topic_id (topic_id),
- ADD INDEX poster_ip (poster_ip),
- ADD INDEX post_visibility (post_visibility),
- MODIFY COLUMN post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
- ADD COLUMN post_encoding varchar(11) DEFAULT \'iso-8859-15\' NOT NULL';
+ $sql = 'ALTER TABLE ' . $table_prefix . 'posts
+ ADD PRIMARY KEY (post_id),
+ ADD INDEX topic_id (topic_id),
+ ADD INDEX poster_ip (poster_ip),
+ ADD INDEX post_visibility (post_visibility),
+ MODIFY COLUMN post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
+ ADD COLUMN post_encoding varchar(11) DEFAULT \'iso-8859-15\' NOT NULL';
break;
case 'mssql':
@@ -78,9 +78,9 @@ $db->sql_query($sql);
$sql = "UPDATE {$table_prefix}users SET user_id = 1 WHERE user_id = 0";
$db->sql_query($sql);
-$sql = "SELECT t.topic_id
- FROM {$table_prefix}topics t
- LEFT JOIN {$table_prefix}posts p ON p.topic_id = t.topic_id
+$sql = "SELECT t.topic_id
+ FROM {$table_prefix}topics t
+ LEFT JOIN {$table_prefix}posts p ON p.topic_id = t.topic_id
WHERE p.topic_id IS NULL";
$result = $db->sql_query($sql);
@@ -93,15 +93,15 @@ if ($row = $db->sql_fetchrow($result))
}
while ($row = $db->sql_fetchrow($result));
- $sql = "DELETE FROM {$table_prefix}topics
+ $sql = "DELETE FROM {$table_prefix}topics
WHERE topic_id IN ($del_sql)";
$db->sql_query($sql);
}
$db->sql_freeresult($result);
$del_sql = '';
-$sql = "SELECT topic_id, MIN(post_id) AS first_post_id, MAX(post_id) AS last_post_id, COUNT(post_id) AS total_posts
- FROM {$table_prefix}posts
+$sql = "SELECT topic_id, MIN(post_id) AS first_post_id, MAX(post_id) AS last_post_id, COUNT(post_id) AS total_posts
+ FROM {$table_prefix}posts
GROUP BY topic_id";
$result = $db->sql_query($sql);
@@ -109,7 +109,7 @@ while ($row = $db->sql_fetchrow($result))
{
$del_sql .= (($del_sql != '') ? ', ' : '') . $row['topic_id'];
- $sql = "UPDATE {$table_prefix}topics
+ $sql = "UPDATE {$table_prefix}topics
SET topic_first_post_id = " . $row['first_post_id'] . ", topic_last_post_id = " . $row['last_post_id'] . ", topic_replies = " . ($row['total_posts'] - 1) . "
WHERE topic_id = " . $row['topic_id'];
$db->sql_query($sql);
@@ -120,8 +120,8 @@ $sql = "DELETE FROM {$table_prefix}topics WHERE topic_id NOT IN ($del_sql)";
$db->sql_query($sql);
$topic_count = $post_count = array();
-$sql = "SELECT forum_id, COUNT(topic_id) AS topics
- FROM {$table_prefix}topics
+$sql = "SELECT forum_id, COUNT(topic_id) AS topics
+ FROM {$table_prefix}topics
GROUP BY forum_id";
$result = $db->sql_query($sql);
@@ -131,8 +131,8 @@ while ($row = $db->sql_fetchrow($result))
}
$db->sql_freeresult($result);
-$sql = "SELECT forum_id, COUNT(post_id) AS posts
- FROM {$table_prefix}posts
+$sql = "SELECT forum_id, COUNT(post_id) AS posts
+ FROM {$table_prefix}posts
GROUP BY forum_id";
$result = $db->sql_query($sql);
@@ -166,13 +166,13 @@ while ($row = $db->sql_fetchrow($result))
$forum_id = $row['forum_id'];
$sql_ary[] = "UPDATE " . $table_prefix . "forums
- SET forum_last_poster_id = " . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? $row['user_id'] : ANONYMOUS) . ", forum_last_poster_name = '" . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? addslashes($row['username']) : addslashes($row['post_username'])) . "', forum_last_post_time = " . $row['post_time'] . ", forum_posts_approved = " . (($post_count[$forum_id]) ? $post_count[$forum_id] : 0) . ", forum_topics_approved = " . (($topic_count[$forum_id]) ? $topic_count[$forum_id] : 0) . "
+ SET forum_last_poster_id = " . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? $row['user_id'] : ANONYMOUS) . ", forum_last_poster_name = '" . ((!empty($row['user_id']) && $row['user_id'] != ANONYMOUS) ? addslashes($row['username']) : addslashes($row['post_username'])) . "', forum_last_post_time = " . $row['post_time'] . ", forum_posts_approved = " . (($post_count[$forum_id]) ? $post_count[$forum_id] : 0) . ", forum_topics_approved = " . (($topic_count[$forum_id]) ? $topic_count[$forum_id] : 0) . "
WHERE forum_id = $forum_id";
$sql = "SELECT t.topic_id, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
FROM " . $table_prefix . "topics t, " . $table_prefix . "users u, " . $table_prefix . "posts p, " . $table_prefix . "posts p2, " . $table_prefix . "users u2
- WHERE t.forum_id = $forum_id
- AND u.user_id = t.topic_poster
+ WHERE t.forum_id = $forum_id
+ AND u.user_id = t.topic_poster
AND p.post_id = t.topic_first_post_id
AND p2.post_id = t.topic_last_post_id
AND u2.user_id = p2.poster_id";
@@ -192,7 +192,7 @@ $db->sql_freeresult($result);
foreach ($sql_ary as $sql)
{
- $sql . "
";
+ echo $sql . "
";
$db->sql_query($sql);
}
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index e3e04c724f..fb65914944 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -335,7 +335,7 @@ class acp_styles
$uninstalled = array();
foreach ($rows as $style)
{
- $result = $this->uninstall_style($style, $delete_files);
+ $result = $this->uninstall_style($style);
if (is_string($result))
{
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index c4c7f330ac..aa4bab2283 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -33,6 +33,8 @@ class bbcode
var $template_bitfield;
+ protected $template_filename;
+
/**
* Constructor
*/
@@ -149,7 +151,7 @@ class bbcode
*/
function bbcode_cache_init()
{
- global $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem;
+ global $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_container;
if (empty($this->template_filename))
{
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index e418115a61..2ec615c1c6 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -61,7 +61,6 @@ define('ACL_YES', 1);
define('ACL_NO', -1);
// Login error codes
-define('LOGIN_CONTINUE', 1);
define('LOGIN_BREAK', 2);
define('LOGIN_SUCCESS', 3);
define('LOGIN_SUCCESS_CREATE_PROFILE', 20);
@@ -121,10 +120,6 @@ define('POST_STICKY', 1);
define('POST_ANNOUNCE', 2);
define('POST_GLOBAL', 3);
-// Lastread types
-define('TRACK_NORMAL', 0);
-define('TRACK_POSTED', 1);
-
// Notify methods
define('NOTIFY_EMAIL', 0);
define('NOTIFY_IM', 1);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 2cf8f381d6..4999d1f0f5 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -915,7 +915,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
/**
* Get topic tracking info by using already fetched info
*/
-function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $global_announce_list = false)
+function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time)
{
global $user;
@@ -959,7 +959,7 @@ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $
/**
* Get topic tracking info from db (for cookie based tracking only this function is used)
*/
-function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_list = false)
+function get_complete_topic_tracking($forum_id, $topic_ids)
{
global $config, $user, $request;
@@ -3216,8 +3216,6 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
*/
function phpbb_filter_root_path($errfile)
{
- global $phpbb_filesystem;
-
static $root_path;
if (empty($root_path))
@@ -4098,25 +4096,6 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
return;
}
-/**
-* Check and display the SQL report if requested.
-*
-* @param \phpbb\request\request_interface $request Request object
-* @param \phpbb\auth\auth $auth Auth object
-* @param \phpbb\db\driver\driver_interface $db Database connection
- *
- * @deprecated 3.3.1 (To be removed: 4.0.0-a1); use controller helper's display_sql_report()
-*/
-function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db)
-{
- global $phpbb_container;
-
- /** @var \phpbb\controller\helper $controller_helper */
- $controller_helper = $phpbb_container->get('controller.helper');
-
- $controller_helper->display_sql_report();
-}
-
/**
* Generate the debug output string
*
@@ -4316,19 +4295,6 @@ function exit_handler()
exit;
}
-/**
-* Casts a numeric string $input to an appropriate numeric type (i.e. integer or float)
-*
-* @param string $input A numeric string.
-*
-* @return int|float Integer $input if $input fits integer,
-* float $input otherwise.
-*/
-function phpbb_to_numeric($input)
-{
- return ($input > PHP_INT_MAX) ? (float) $input : (int) $input;
-}
-
/**
* Get the board contact details (e.g. for emails)
*
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 8ac17591f4..6a602b7de8 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -152,8 +152,11 @@ function adm_page_header($page_title)
function adm_page_footer($copyright_html = true)
{
global $db, $config, $template, $user, $auth;
- global $phpbb_root_path;
- global $request, $phpbb_dispatcher;
+ global $phpbb_root_path, $phpbb_container;
+ global $phpbb_dispatcher;
+
+ /** @var \phpbb\controller\helper $controller_helper */
+ $controller_helper = $phpbb_container->get('controller.helper');
// A listener can set this variable to `true` when it overrides this function
$adm_page_footer_override = false;
@@ -175,7 +178,7 @@ function adm_page_footer($copyright_html = true)
return;
}
- phpbb_check_and_display_sql_report($request, $auth, $db);
+ $controller_helper->display_sql_report();
$template->assign_vars(array(
'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher),
@@ -707,6 +710,7 @@ function validate_range($value_ary, &$error)
/**
* Inserts new config display_vars into an exisiting display_vars array
* at the given position.
+* Used by extensions.
*
* @param array $display_vars An array of existing config display vars
* @param array $add_config_vars An array of new config display vars
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index b190fcf899..67dd3212d3 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -978,7 +978,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
}
$approved_posts = 0;
- $post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array();
+ $post_ids = $poster_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array();
$sql = 'SELECT post_id, poster_id, post_visibility, post_postcount, topic_id, forum_id
FROM ' . POSTS_TABLE . '
@@ -1518,7 +1518,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
// $post_reported should be empty by now, if it's not it contains
// posts that are falsely flagged as reported
- foreach ($post_reported as $post_id => $void)
+ foreach (array_keys($post_reported) as $post_id)
{
$post_ids[] = $post_id;
}
@@ -1623,7 +1623,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
// $post_attachment should be empty by now, if it's not it contains
// posts that are falsely flagged as having attachments
- foreach ($post_attachment as $post_id => $void)
+ foreach (array_keys($post_attachment) as $post_id)
{
$post_ids[] = $post_id;
}
@@ -1696,7 +1696,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$where_sql";
$result = $db->sql_query($sql);
- $forum_data = $forum_ids = $post_ids = $last_post_id = $post_info = array();
+ $forum_data = $forum_ids = $post_ids = $post_info = array();
while ($row = $db->sql_fetchrow($result))
{
if ($row['forum_type'] == FORUM_LINK)
@@ -2031,7 +2031,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
if (count($delete_topics))
{
$delete_topic_ids = array();
- foreach ($delete_topics as $topic_id => $void)
+ foreach (array_keys($delete_topics) as $topic_id)
{
unset($topic_data[$topic_id]);
$delete_topic_ids[] = $topic_id;
@@ -2605,7 +2605,7 @@ function phpbb_cache_moderators($db, $cache, $auth)
* @param mixed $forum_id Restrict the log entries to the given forum_id (can also be an array of forum_ids)
* @param int $topic_id Restrict the log entries to the given topic_id
* @param int $user_id Restrict the log entries to the given user_id
-* @param int $log_time Only get log entries newer than the given timestamp
+* @param int $limit_days Only get log entries newer than the given timestamp
* @param string $sort_by SQL order option, e.g. 'l.log_time DESC'
* @param string $keywords Will only return log entries that have the keywords in log_operation or log_data
*
diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php
index 939254fd83..ac5165a2f5 100644
--- a/phpBB/includes/functions_compatibility.php
+++ b/phpBB/includes/functions_compatibility.php
@@ -847,3 +847,37 @@ function phpbb_delete_user_pms($user_id)
return phpbb_delete_users_pms(array($user_id));
}
+
+/**
+* Casts a numeric string $input to an appropriate numeric type (i.e. integer or float)
+*
+* @param string $input A numeric string.
+*
+* @return int|float Integer $input if $input fits integer,
+* float $input otherwise.
+*
+* @deprecated 3.2.10 (To be removed 4.0.0)
+*/
+function phpbb_to_numeric($input)
+{
+ return ($input > PHP_INT_MAX) ? (float) $input : (int) $input;
+}
+
+/**
+* Check and display the SQL report if requested.
+*
+* @param \phpbb\request\request_interface $request Request object
+* @param \phpbb\auth\auth $auth Auth object
+* @param \phpbb\db\driver\driver_interface $db Database connection
+*
+* @deprecated 3.3.1 (To be removed: 4.0.0-a1); use controller helper's display_sql_report()
+*/
+function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db)
+{
+ global $phpbb_container;
+
+ /** @var \phpbb\controller\helper $controller_helper */
+ $controller_helper = $phpbb_container->get('controller.helper');
+
+ $controller_helper->display_sql_report();
+}
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index c547957c2a..6a5263c1e1 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -320,7 +320,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
* Generates a text with approx. the specified length which contains the specified words and their context
*
* @param string $text The full text from which context shall be extracted
-* @param string $words An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!)
+* @param array $words An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!)
* @param int $length The desired length of the resulting text, however the result might be shorter or longer than this value
*
* @return string Context of the specified words separated by "..."
@@ -845,7 +845,6 @@ function make_clickable_callback($type, $whitespace, $url, $relative_url, $class
$relative_url = substr($relative_url, 0, $split);
}
}
-
// if the last character of the url is a punctuation mark, exclude it from the url
$last_char = ($relative_url) ? $relative_url[strlen($relative_url) - 1] : $url[strlen($url) - 1];
@@ -1344,7 +1343,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a
preg_match_all('#(.*?)#', $message, $matches, PREG_PATTERN_ORDER);
$replace = array();
- foreach ($matches[0] as $num => $capture)
+ foreach (array_keys($matches[0]) as $num)
{
$index = $matches[1][$num];
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 9a7bcab3ea..b72f71d9b3 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -767,7 +767,7 @@ function generate_forum_nav(&$forum_data_ary)
return;
}
- $navlinks_parents = $forum_template_data = array();
+ $navlinks_parents = array();
// Get forum parents
$forum_parents = get_forum_parents($forum_data_ary);
diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php
index b3e12e78e4..1300d3454b 100644
--- a/phpBB/includes/functions_mcp.php
+++ b/phpBB/includes/functions_mcp.php
@@ -535,7 +535,6 @@ function phpbb_mcp_sorting($mode, &$sort_days_val, &$sort_key_val, &$sort_dir_va
$sort_key_val = $request->variable('sk', $default_key);
$sort_dir_val = $request->variable('sd', $default_dir);
- $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
switch ($type)
{
@@ -680,11 +679,11 @@ function phpbb_mcp_sorting($mode, &$sort_days_val, &$sort_key_val, &$sort_dir_va
/**
* Validate ids
*
-* @param array &$ids The relevant ids to check
-* @param string $table The table to find the ids in
-* @param string $sql_id The ids relevant column name
-* @param array $acl_list A list of permissions the user need to have
-* @param mixed $singe_forum Limit to one forum id (int) or the first forum found (true)
+* @param array &$ids The relevant ids to check
+* @param string $table The table to find the ids in
+* @param string $sql_id The ids relevant column name
+* @param array|false $acl_list A list of permissions the user need to have
+* @param mixed $single_forum Limit to one forum id (int) or the first forum found (true)
*
* @return mixed False if no ids were able to be retrieved, true if at least one id left.
* Additionally, this value can be the forum_id assigned if $single_forum was set.
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 0413c4f2fe..47c18f6dd9 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -469,7 +469,7 @@ class messenger
$domain = ($config['server_name']) ?: $request->server('SERVER_NAME', 'phpbb.generated');
- return md5(unique_id(time())) . '@' . $domain;
+ return md5(unique_id()) . '@' . $domain;
}
/**
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 0d37470dcf..b00534d92a 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -327,7 +327,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
{
$empty_forums = array_merge($empty_forums, array_diff($ids, $not_empty_forums));
- foreach ($empty_forums as $void => $forum_id)
+ foreach ($empty_forums as $forum_id)
{
$update_sql[$forum_id][] = 'forum_last_post_id = 0';
$update_sql[$forum_id][] = "forum_last_post_subject = ''";
@@ -838,7 +838,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
global $user, $db, $template, $auth;
global $phpbb_root_path, $phpbb_dispatcher, $phpEx;
- $topic_ids = $forum_ids = $draft_rows = array();
+ $topic_ids = $draft_rows = array();
// Load those drafts not connected to forums/topics
// If forum_id == 0 AND topic_id == 0 then this is a PM draft
@@ -1619,7 +1619,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
$data_ary['topic_title'] = truncate_string($data_ary['topic_title'], 120);
// Collect some basic information about which tables and which rows to update/insert
- $sql_data = $topic_row = array();
+ $sql_data = array();
$poster_id = ($mode == 'edit') ? $data_ary['poster_id'] : (int) $user->data['user_id'];
// Retrieve some additional information if not present
@@ -2098,7 +2098,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
$space_taken = $files_added = 0;
$orphan_rows = array();
- foreach ($data_ary['attachment_data'] as $pos => $attach_row)
+ foreach ($data_ary['attachment_data'] as $attach_row)
{
$orphan_rows[(int) $attach_row['attach_id']] = array();
}
@@ -2120,7 +2120,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
$db->sql_freeresult($result);
}
- foreach ($data_ary['attachment_data'] as $pos => $attach_row)
+ foreach ($data_ary['attachment_data'] as $attach_row)
{
if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']]))
{
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index d35aef0eb7..5e7033d09c 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -455,7 +455,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
}
else
{
- $user_rules = $zebra = $check_rows = array();
+ $zebra = $check_rows = array();
$user_ids = $memberships = array();
// First of all, grab all rules and retrieve friends/foes
@@ -551,7 +551,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
// It is allowed to execute actions more than once, except placing messages into folder
$folder_action = $message_removed = false;
- foreach ($msg_ary as $pos => $rule_ary)
+ foreach ($msg_ary as $rule_ary)
{
if ($folder_action && $rule_ary['action'] == ACTION_PLACE_INTO_FOLDER)
{
@@ -1598,7 +1598,7 @@ function get_folder_status($folder_id, $folder)
*/
function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true)
{
- global $db, $auth, $config, $user, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $request;
+ global $db, $auth, $config, $user, $phpbb_container, $phpbb_dispatcher, $request;
$attachment_storage = $phpbb_container->get('storage.attachment');
@@ -1827,7 +1827,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true)
$space_taken = $files_added = 0;
$orphan_rows = array();
- foreach ($data_ary['attachment_data'] as $pos => $attach_row)
+ foreach ($data_ary['attachment_data'] as $attach_row)
{
$orphan_rows[(int) $attach_row['attach_id']] = array();
}
@@ -1850,7 +1850,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true)
$db->sql_freeresult($result);
}
- foreach ($data_ary['attachment_data'] as $pos => $attach_row)
+ foreach ($data_ary['attachment_data'] as $attach_row)
{
if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']]))
{
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index e93b017e4d..e07871b51c 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -180,7 +180,7 @@ function user_update_name($old_name, $new_name)
* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded.
* @param array $cp_data custom profile fields, see custom_profile::build_insert_sql_array
* @param array $notifications_data The notifications settings for the new user
-* @return the new user's ID.
+* @return int The new user's ID.
*/
function user_add($user_row, $cp_data = false, $notifications_data = null)
{
@@ -1610,7 +1610,8 @@ function validate_num($num, $optional = false, $min = 0, $max = 1E99)
/**
* Validate Date
-* @param String $string a date in the dd-mm-yyyy format
+* @param string $date_string a date in the dd-mm-yyyy format
+* @param bool $optional
* @return boolean
*/
function validate_date($date_string, $optional = false)
@@ -1646,7 +1647,6 @@ function validate_date($date_string, $optional = false)
return false;
}
-
/**
* Validate Match
*
@@ -2216,7 +2216,7 @@ function phpbb_style_is_active($style_id)
*/
function avatar_delete($mode, $row, $clean_db = false)
{
- global $config, $phpbb_container;
+ global $phpbb_container;
$storage = $phpbb_container->get('storage.avatar');
@@ -2576,7 +2576,7 @@ function group_correct_avatar($group_id, $old_entry)
try
{
- $this->storage->rename($old_filename, $new_filename);
+ $storage->rename($old_filename, $new_filename);
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_avatar = \'' . $db->sql_escape($new_entry) . "'
diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php
index 5ead3b7fbb..46e8bda7c7 100644
--- a/phpBB/includes/startup.php
+++ b/phpBB/includes/startup.php
@@ -29,8 +29,6 @@ if (version_compare(PHP_VERSION, '7.1.3', '<'))
{
die('You are running an unsupported PHP version. Please upgrade to PHP 7.1.3 or higher before trying to install or update to phpBB 3.3');
}
-// Register globals and magic quotes have been dropped in PHP 5.4 so no need for extra checks
-
// In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems
// because we show E_WARNING errors and do not set a default timezone.
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index e187bbb89f..c1e5df8f32 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -81,7 +81,6 @@ switch ($mode)
login_box('', ((isset($user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $user->lang['LOGIN_EXPLAIN_MEMBERLIST']));
}
- break;
}
/** @var \phpbb\group\helper $group_helper */
diff --git a/phpBB/phpbb/attachment/upload.php b/phpBB/phpbb/attachment/upload.php
index 21be17ef22..d823e17bd0 100644
--- a/phpBB/phpbb/attachment/upload.php
+++ b/phpBB/phpbb/attachment/upload.php
@@ -18,7 +18,6 @@ use \phpbb\cache\service;
use \phpbb\config\config;
use \phpbb\event\dispatcher;
use \phpbb\language\language;
-use \phpbb\mimetype\guesser;
use \phpbb\plupload\plupload;
use \phpbb\storage\storage;
use \phpbb\filesystem\temp;
@@ -44,9 +43,6 @@ class upload
/** @var language */
protected $language;
- /** @var guesser Mimetype guesser */
- protected $mimetype_guesser;
-
/** @var dispatcher */
protected $phpbb_dispatcher;
@@ -62,7 +58,7 @@ class upload
/** @var user */
protected $user;
- /** @var \phpbb\files\filespec Current filespec instance */
+ /** @var \phpbb\files\filespec_storage Current filespec instance */
private $file;
/** @var array File data */
@@ -81,21 +77,19 @@ class upload
* @param config $config
* @param \phpbb\files\upload $files_upload
* @param language $language
- * @param guesser $mimetype_guesser
* @param dispatcher $phpbb_dispatcher
* @param plupload $plupload
* @param storage $storage
* @param temp $temp
* @param user $user
*/
- public function __construct(auth $auth, service $cache, config $config, \phpbb\files\upload $files_upload, language $language, guesser $mimetype_guesser, dispatcher $phpbb_dispatcher, plupload $plupload, storage $storage, temp $temp, user $user)
+ public function __construct(auth $auth, service $cache, config $config, \phpbb\files\upload $files_upload, language $language, dispatcher $phpbb_dispatcher, plupload $plupload, storage $storage, temp $temp, user $user)
{
$this->auth = $auth;
$this->cache = $cache;
$this->config = $config;
$this->files_upload = $files_upload;
$this->language = $language;
- $this->mimetype_guesser = $mimetype_guesser;
$this->phpbb_dispatcher = $phpbb_dispatcher;
$this->plupload = $plupload;
$this->storage = $storage;
@@ -233,8 +227,6 @@ class upload
/**
* Create thumbnail for file if necessary
- *
- * @return array Updated $filedata
*/
protected function create_thumbnail()
{
diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php
index f46a21a8ae..0482ae46a4 100644
--- a/phpBB/phpbb/auth/auth.php
+++ b/phpBB/phpbb/auth/auth.php
@@ -95,8 +95,6 @@ class auth
$this->acl_cache($userdata);
$this->_fill_acl($userdata['user_permissions']);
}
-
- return;
}
/**
@@ -213,7 +211,7 @@ class auth
* @param bool $clean set to true if only values needs to be returned which are set/unset
*
* @return array Contains the forum ids with the specified permission set to true.
- This is a nested array: array => forum_id => permission => true
+ * This is a nested array: array => forum_id => permission => true
*/
function acl_getf($opt, $clean = false)
{
@@ -524,19 +522,19 @@ class auth
ORDER BY role_id ASC';
$result = $db->sql_query($sql);
- $this->role_cache = array();
+ $role_cache = array();
while ($row = $db->sql_fetchrow($result))
{
- $this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
+ $role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
}
$db->sql_freeresult($result);
- foreach ($this->role_cache as $role_id => $role_options)
+ foreach ($role_cache as $role_id => $role_options)
{
- $this->role_cache[$role_id] = serialize($role_options);
+ $role_cache[$role_id] = serialize($role_options);
}
- $cache->put('_role_cache', $this->role_cache);
+ $cache->put('_role_cache', $role_cache);
// Now empty user permissions
$where_sql = '';
@@ -562,8 +560,6 @@ class auth
*/
$vars = array('user_id');
extract($phpbb_dispatcher->trigger_event('core.acl_clear_prefetch_after', compact($vars)));
-
- return;
}
/**
@@ -828,9 +824,9 @@ class auth
global $db, $cache;
// Check if the role-cache is there
- if (($this->role_cache = $cache->get('_role_cache')) === false)
+ if (($role_cache = $cache->get('_role_cache')) === false)
{
- $this->role_cache = array();
+ $role_cache = array();
// We pre-fetch roles
$sql = 'SELECT *
@@ -840,16 +836,16 @@ class auth
while ($row = $db->sql_fetchrow($result))
{
- $this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
+ $role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
}
$db->sql_freeresult($result);
- foreach ($this->role_cache as $role_id => $role_options)
+ foreach ($role_cache as $role_id => $role_options)
{
- $this->role_cache[$role_id] = serialize($role_options);
+ $role_cache[$role_id] = serialize($role_options);
}
- $cache->put('_role_cache', $this->role_cache);
+ $cache->put('_role_cache', $role_cache);
}
$hold_ary = array();
@@ -865,7 +861,7 @@ class auth
// If a role is assigned, assign all options included within this role. Else, only set this one option.
if ($row['auth_role_id'])
{
- $hold_ary[$row['forum_id']] = (empty($hold_ary[$row['forum_id']])) ? unserialize($this->role_cache[$row['auth_role_id']]) : $hold_ary[$row['forum_id']] + unserialize($this->role_cache[$row['auth_role_id']]);
+ $hold_ary[$row['forum_id']] = (empty($hold_ary[$row['forum_id']])) ? unserialize($role_cache[$row['auth_role_id']]) : $hold_ary[$row['forum_id']] + unserialize($role_cache[$row['auth_role_id']]);
}
else
{
@@ -890,9 +886,9 @@ class auth
{
$this->_set_group_hold_ary($hold_ary[$row['forum_id']], $row['auth_option_id'], $row['auth_setting']);
}
- else if (!empty($this->role_cache[$row['auth_role_id']]))
+ else if (!empty($role_cache[$row['auth_role_id']]))
{
- foreach (unserialize($this->role_cache[$row['auth_role_id']]) as $option_id => $setting)
+ foreach (unserialize($role_cache[$row['auth_role_id']]) as $option_id => $setting)
{
$this->_set_group_hold_ary($hold_ary[$row['forum_id']], $option_id, $setting);
}
diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php
index a70734fcbe..c25d69d3d8 100644
--- a/phpBB/phpbb/auth/provider/db.php
+++ b/phpBB/phpbb/auth/provider/db.php
@@ -17,7 +17,6 @@ use phpbb\captcha\factory;
use phpbb\config\config;
use phpbb\db\driver\driver_interface;
use phpbb\passwords\manager;
-use phpbb\request\request_interface;
use phpbb\user;
/**
@@ -35,18 +34,9 @@ class db extends base
/** @var driver_interface DBAL driver instance */
protected $db;
- /** @var request_interface Request object */
- protected $request;
-
/** @var user User object */
protected $user;
- /** @var string phpBB root path */
- protected $phpbb_root_path;
-
- /** @var string PHP file extension */
- protected $php_ext;
-
/**
* phpBB passwords manager
*
@@ -61,21 +51,15 @@ class db extends base
* @param config $config
* @param driver_interface $db
* @param manager $passwords_manager
- * @param request_interface $request
* @param user $user
- * @param string $phpbb_root_path
- * @param string $php_ext
*/
- public function __construct(factory $captcha_factory, config $config, driver_interface $db, manager $passwords_manager, request_interface $request, user $user, $phpbb_root_path, $php_ext)
+ public function __construct(factory $captcha_factory, config $config, driver_interface $db, manager $passwords_manager, user $user)
{
$this->captcha_factory = $captcha_factory;
$this->config = $config;
$this->db = $db;
$this->passwords_manager = $passwords_manager;
- $this->request = $request;
$this->user = $user;
- $this->phpbb_root_path = $phpbb_root_path;
- $this->php_ext = $php_ext;
}
/**
diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php
index 45681f3e59..03c4790a6e 100644
--- a/phpBB/phpbb/avatar/driver/driver.php
+++ b/phpBB/phpbb/avatar/driver/driver.php
@@ -80,7 +80,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
* @param string $phpbb_root_path Path to the phpBB root
* @param string $php_ext PHP file extension
* @param \phpbb\path_helper $path_helper phpBB path helper
- * @param \phpbb\cache\driver\driver_interface $cache Cache driver
+ * @param \phpbb\cache\driver\driver_interface|null $cache Cache driver
*/
public function __construct(\phpbb\config\config $config, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface $cache = null)
{
diff --git a/phpBB/phpbb/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php
index cbd8da90e2..ea77497390 100644
--- a/phpBB/phpbb/avatar/driver/gravatar.php
+++ b/phpBB/phpbb/avatar/driver/gravatar.php
@@ -114,7 +114,7 @@ class gravatar extends \phpbb\avatar\driver\driver
return false;
}
- if (!empty($image_data) && ($image_data['width'] <= 0 || $image_data['width'] <= 0))
+ if (!empty($image_data) && ($image_data['width'] <= 0 || $image_data['height'] <= 0))
{
$error[] = 'AVATAR_NO_SIZE';
return false;
diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php
index 4b84e4201c..2b79cb1e4a 100644
--- a/phpBB/phpbb/avatar/driver/local.php
+++ b/phpBB/phpbb/avatar/driver/local.php
@@ -40,7 +40,7 @@ class local extends \phpbb\avatar\driver\driver
$avatar_list = $this->get_avatar_list($user);
$category = $request->variable('avatar_local_cat', key($avatar_list));
- foreach ($avatar_list as $cat => $null)
+ foreach (array_keys($avatar_list) as $cat)
{
if (!empty($avatar_list[$cat]))
{
@@ -63,7 +63,7 @@ class local extends \phpbb\avatar\driver\driver
));
$table_cols = isset($row['avatar_gallery_cols']) ? $row['avatar_gallery_cols'] : 4;
- $row_count = $col_count = $avatar_pos = 0;
+ $col_count = $avatar_pos = 0;
$avatar_count = count($avatar_list[$category]);
reset($avatar_list[$category]);
@@ -75,7 +75,6 @@ class local extends \phpbb\avatar\driver\driver
if ($col_count == 0)
{
- ++$row_count;
$template->assign_block_vars('avatar_local_row', array(
));
}
diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php
index a909a91042..c1e414ac22 100644
--- a/phpBB/phpbb/avatar/manager.php
+++ b/phpBB/phpbb/avatar/manager.php
@@ -29,7 +29,7 @@ class manager
/**
* Array that contains a list of enabled drivers
- * @var array
+ * @var array|bool
*/
static protected $enabled_drivers = false;
diff --git a/phpBB/phpbb/captcha/gd.php b/phpBB/phpbb/captcha/gd.php
index 91b2f89d81..7f4d26ff00 100644
--- a/phpBB/phpbb/captcha/gd.php
+++ b/phpBB/phpbb/captcha/gd.php
@@ -90,7 +90,7 @@ class gd
}
}
- if ($config['captcha_gd_wave'] && ($config['captcha_gd_y_grid'] || $config['captcha_gd_y_grid']))
+ if ($config['captcha_gd_wave'] && ($config['captcha_gd_x_grid'] || $config['captcha_gd_y_grid']))
{
$this->wave($img);
}
diff --git a/phpBB/phpbb/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
index b508767d17..48605fe17a 100644
--- a/phpBB/phpbb/captcha/plugins/captcha_abstract.php
+++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
@@ -235,7 +235,7 @@ abstract class captcha_abstract
global $db, $user;
$this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
- $this->confirm_id = md5(unique_id($user->ip));
+ $this->confirm_id = md5(unique_id());
$this->seed = hexdec(substr(unique_id(), 4, 10));
$this->solved = 0;
// compute $seed % 0x7fffffff
diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php
index 966b8d32f2..12280e5d7d 100644
--- a/phpBB/phpbb/captcha/plugins/qa.php
+++ b/phpBB/phpbb/captcha/plugins/qa.php
@@ -442,7 +442,7 @@ class qa
{
return;
}
- $this->confirm_id = md5(unique_id($user->ip));
+ $this->confirm_id = md5(unique_id());
$this->question = (int) array_rand($this->question_ids);
$sql = 'INSERT INTO ' . $this->table_qa_confirm . ' ' . $db->sql_build_array('INSERT', array(
diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php
index a4b69311ca..19242049aa 100644
--- a/phpBB/phpbb/class_loader.php
+++ b/phpBB/phpbb/class_loader.php
@@ -46,7 +46,7 @@ class class_loader
* @param string $namespace Required namespace for files to be loaded
* @param string $path Directory to load files from
* @param string $php_ext The file extension for PHP files
- * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface.
+ * @param \phpbb\cache\driver\driver_interface|null $cache An implementation of the phpBB cache interface.
*/
public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null)
{
@@ -67,7 +67,7 @@ class class_loader
* the class loader will resolve paths by checking for the existence of every
* directory in the class name every time.
*
- * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface.
+ * @param \phpbb\cache\driver\driver_interface|null $cache An implementation of the phpBB cache interface.
*/
public function set_cache(\phpbb\cache\driver\driver_interface $cache = null)
{
diff --git a/phpBB/phpbb/composer/exception/managed_with_clean_error_exception.php b/phpBB/phpbb/composer/exception/managed_with_clean_error_exception.php
index 2339fa4096..22addce1b7 100644
--- a/phpBB/phpbb/composer/exception/managed_with_clean_error_exception.php
+++ b/phpBB/phpbb/composer/exception/managed_with_clean_error_exception.php
@@ -24,7 +24,7 @@ class managed_with_clean_error_exception extends managed_with_error_exception
* @param string $prefix The language string prefix
* @param string $message The Exception message to throw (must be a language variable).
* @param array $parameters The parameters to use with the language var.
- * @param \Exception $previous The previous runtime_exception used for the runtime_exception chaining.
+ * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
* @param integer $code The Exception code.
*/
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
diff --git a/phpBB/phpbb/composer/exception/managed_with_enable_error_exception.php b/phpBB/phpbb/composer/exception/managed_with_enable_error_exception.php
index 7ef7a42df3..f9b3ce571b 100644
--- a/phpBB/phpbb/composer/exception/managed_with_enable_error_exception.php
+++ b/phpBB/phpbb/composer/exception/managed_with_enable_error_exception.php
@@ -24,7 +24,7 @@ class managed_with_enable_error_exception extends managed_with_error_exception
* @param string $prefix The language string prefix
* @param string $message The Exception message to throw (must be a language variable).
* @param array $parameters The parameters to use with the language var.
- * @param \Exception $previous The previous runtime_exception used for the runtime_exception chaining.
+ * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
* @param integer $code The Exception code.
*/
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
diff --git a/phpBB/phpbb/composer/exception/managed_with_error_exception.php b/phpBB/phpbb/composer/exception/managed_with_error_exception.php
index 9e7c67580e..2ea4600cf6 100644
--- a/phpBB/phpbb/composer/exception/managed_with_error_exception.php
+++ b/phpBB/phpbb/composer/exception/managed_with_error_exception.php
@@ -24,7 +24,7 @@ class managed_with_error_exception extends runtime_exception
* @param string $prefix The language string prefix
* @param string $message The Exception message to throw (must be a language variable).
* @param array $parameters The parameters to use with the language var.
- * @param \Exception $previous The previous runtime_exception used for the runtime_exception chaining.
+ * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
* @param integer $code The Exception code.
*/
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
diff --git a/phpBB/phpbb/composer/exception/runtime_exception.php b/phpBB/phpbb/composer/exception/runtime_exception.php
index eb92759318..adbb67994f 100644
--- a/phpBB/phpbb/composer/exception/runtime_exception.php
+++ b/phpBB/phpbb/composer/exception/runtime_exception.php
@@ -26,7 +26,7 @@ class runtime_exception extends base
* @param string $prefix The language string prefix
* @param string $message The Exception message to throw (must be a language variable).
* @param array $parameters The parameters to use with the language var.
- * @param \Exception $previous The previous runtime_exception used for the runtime_exception chaining.
+ * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
* @param integer $code The Exception code.
*/
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
diff --git a/phpBB/phpbb/composer/extension_manager.php b/phpBB/phpbb/composer/extension_manager.php
index 96250e9dd3..5c056c2136 100644
--- a/phpBB/phpbb/composer/extension_manager.php
+++ b/phpBB/phpbb/composer/extension_manager.php
@@ -38,6 +38,11 @@ class extension_manager extends manager
*/
protected $filesystem;
+ /**
+ * @var string
+ */
+ protected $root_path;
+
/**
* @var array
*/
@@ -61,7 +66,7 @@ class extension_manager extends manager
* @param string $package_type Composer type of managed packages
* @param string $exception_prefix Exception prefix to use
* @param string $root_path phpBB root path
- * @param config $config Config object
+ * @param config|null $config Config object
*/
public function __construct(installer $installer, driver_interface $cache, ext_manager $extension_manager, filesystem $filesystem, $package_type, $exception_prefix, $root_path, config $config = null)
{
diff --git a/phpBB/phpbb/composer/installer.php b/phpBB/phpbb/composer/installer.php
index 1bc2c8e6b4..e7e885b989 100644
--- a/phpBB/phpbb/composer/installer.php
+++ b/phpBB/phpbb/composer/installer.php
@@ -69,12 +69,12 @@ class installer
protected $root_path;
/**
- * @var string Stores the original working directory in case it has been changed through move_to_root()
+ * @var string|null Stores the original working directory in case it has been changed through move_to_root()
*/
private $original_cwd;
/**
- * @var array Stores the content of the ext json file before generate_ext_json_file() overrides it
+ * @var array|null Stores the content of the ext json file before generate_ext_json_file() overrides it
*/
private $ext_json_file_backup;
@@ -83,11 +83,16 @@ class installer
*/
private $request;
+ /**
+ * @var filesystem phpBB filesystem
+ */
+ private $filesystem;
+
/**
* @param string $root_path phpBB root path
* @param filesystem $filesystem Filesystem object
* @param request $request phpBB request object
- * @param config $config Config object
+ * @param config|null $config Config object
*/
public function __construct($root_path, filesystem $filesystem, request $request, config $config = null)
{
@@ -108,6 +113,7 @@ class installer
$this->root_path = $root_path;
$this->request = $request;
+ $this->filesystem = $filesystem;
putenv('COMPOSER_HOME=' . filesystem_helper::realpath($root_path) . '/store/composer');
}
@@ -118,7 +124,7 @@ class installer
* @param array $packages Packages to install.
* Each entry may be a name or an array associating a version constraint to a name
* @param array $whitelist White-listed packages (packages that can be installed/updated/removed)
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*
* @throws runtime_exception
*/
@@ -137,7 +143,7 @@ class installer
* @param array $packages Packages to install.
* Each entry may be a name or an array associating a version constraint to a name
* @param array $whitelist White-listed packages (packages that can be installed/updated/removed)
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*
* @throws runtime_exception
*/
@@ -402,9 +408,7 @@ class installer
*/
public function check_requirements()
{
- $filesystem = new \phpbb\filesystem\filesystem();
-
- return $filesystem->is_writable([
+ return $this->filesystem->is_writable([
$this->root_path . $this->composer_filename,
$this->root_path . $this->packages_vendor_dir,
$this->root_path . substr($this->composer_filename, 0, -5) . '.lock',
diff --git a/phpBB/phpbb/composer/io/web_io.php b/phpBB/phpbb/composer/io/web_io.php
index 4eab3d099a..aac7f06088 100644
--- a/phpBB/phpbb/composer/io/web_io.php
+++ b/phpBB/phpbb/composer/io/web_io.php
@@ -26,7 +26,7 @@ class web_io extends BufferIO implements io_interface
* @param language $language Language object
* @param string $input Input string
* @param int $verbosity Verbosity level
- * @param OutputFormatterInterface $formatter Output formatter
+ * @param OutputFormatterInterface|null $formatter Output formatter
*/
public function __construct(language $language, $input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
{
diff --git a/phpBB/phpbb/composer/manager.php b/phpBB/phpbb/composer/manager.php
index 43ea8a2503..d5fe8935cf 100644
--- a/phpBB/phpbb/composer/manager.php
+++ b/phpBB/phpbb/composer/manager.php
@@ -43,17 +43,17 @@ class manager implements manager_interface
protected $exception_prefix;
/**
- * @var array Caches the managed packages list (for the current type)
+ * @var array|null Caches the managed packages list (for the current type)
*/
private $managed_packages;
/**
- * @var array Caches the managed packages list (for all phpBB types)
+ * @var array|null Caches the managed packages list (for all phpBB types)
*/
private $all_managed_packages;
/**
- * @var array Caches the available packages list
+ * @var array|null Caches the available packages list
*/
private $available_packages;
@@ -101,7 +101,7 @@ class manager implements manager_interface
*
* @param array $packages Packages to update.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*/
protected function pre_install(array $packages, IOInterface $io = null)
{
@@ -112,7 +112,7 @@ class manager implements manager_interface
*
* @param array $packages Packages to update.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*/
protected function post_install(array $packages, IOInterface $io = null)
{
@@ -146,7 +146,7 @@ class manager implements manager_interface
*
* @param array $packages Packages to update.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*/
protected function pre_update(array $packages, IOInterface $io = null)
{
@@ -157,7 +157,7 @@ class manager implements manager_interface
*
* @param array $packages Packages to update.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*/
protected function post_update(array $packages, IOInterface $io = null)
{
@@ -193,7 +193,7 @@ class manager implements manager_interface
*
* @param array $packages Packages to update.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*/
protected function pre_remove(array $packages, IOInterface $io = null)
{
@@ -204,7 +204,7 @@ class manager implements manager_interface
*
* @param array $packages Packages to update.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*/
protected function post_remove(array $packages, IOInterface $io = null)
{
diff --git a/phpBB/phpbb/composer/manager_interface.php b/phpBB/phpbb/composer/manager_interface.php
index 3cb401f2b6..0cf6324661 100644
--- a/phpBB/phpbb/composer/manager_interface.php
+++ b/phpBB/phpbb/composer/manager_interface.php
@@ -26,7 +26,7 @@ interface manager_interface
*
* @param array $packages Packages to install.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*
* @throws runtime_exception
*/
@@ -37,7 +37,7 @@ interface manager_interface
*
* @param array $packages Packages to update.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*
* @throws runtime_exception
*/
@@ -48,7 +48,7 @@ interface manager_interface
*
* @param array $packages Packages to remove.
* Each entry may be a name or an array associating a version constraint to a name
- * @param IOInterface $io IO object used for the output
+ * @param IOInterface|null $io IO object used for the output
*
* @throws runtime_exception
*/
diff --git a/phpBB/phpbb/config_php_file.php b/phpBB/phpbb/config_php_file.php
index e3f7357720..be17906ad1 100644
--- a/phpBB/phpbb/config_php_file.php
+++ b/phpBB/phpbb/config_php_file.php
@@ -42,8 +42,6 @@ class config_php_file
*/
protected $config_file;
- private $defined_vars;
-
/**
* Constructor
*
@@ -102,10 +100,11 @@ class config_php_file
{
if (!$this->config_loaded && file_exists($this->config_file))
{
- $this->defined_vars = get_defined_vars();
+ $defined_vars = null; // Define variable before call get_defined_vars
+ $defined_vars = get_defined_vars();
require($this->config_file);
- $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars);
+ $this->config_data = array_diff_key(get_defined_vars(), $defined_vars);
$this->config_loaded = true;
}
diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php
index 475d8a9271..25752ee063 100644
--- a/phpBB/phpbb/console/command/config/set_atomic.php
+++ b/phpBB/phpbb/console/command/config/set_atomic.php
@@ -61,7 +61,7 @@ class set_atomic extends command
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
- * @return bool True if the value was changed, false otherwise.
+ * @return int 0 if the value was changed, 1 otherwise.
* @see \phpbb\config\config::set_atomic()
*/
protected function execute(InputInterface $input, OutputInterface $output)
diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php
index 7b95c20cf2..fe466835e7 100644
--- a/phpBB/phpbb/console/command/thumbnail/delete.php
+++ b/phpBB/phpbb/console/command/thumbnail/delete.php
@@ -37,7 +37,7 @@ class delete extends \phpbb\console\command\command
/**
* Constructor
*
- * @param \config\config $config The config
+ * @param \phpbb\config\config $config The config
* @param \phpbb\user $user The user object (used to get language information)
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param string $phpbb_root_path Root path
diff --git a/phpBB/phpbb/console/command/thumbnail/generate.php b/phpBB/phpbb/console/command/thumbnail/generate.php
index 1f6582b17b..0eec0c30ce 100644
--- a/phpBB/phpbb/console/command/thumbnail/generate.php
+++ b/phpBB/phpbb/console/command/thumbnail/generate.php
@@ -50,7 +50,7 @@ class generate extends \phpbb\console\command\command
/**
* Constructor
*
- * @param \config\config $config The config
+ * @param \phpbb\config\config $config The config
* @param \phpbb\user $user The user object (used to get language information)
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\cache\service $cache The cache service
diff --git a/phpBB/phpbb/console/command/update/check.php b/phpBB/phpbb/console/command/update/check.php
index 4cd7d2155c..853f2dc33d 100644
--- a/phpBB/phpbb/console/command/update/check.php
+++ b/phpBB/phpbb/console/command/update/check.php
@@ -29,7 +29,7 @@ class check extends \phpbb\console\command\command
/** @var \phpbb\config\config */
protected $config;
- /** @var \Symfony\Component\DependencyInjection\ContainerBuilder */
+ /** @var ContainerInterface */
protected $phpbb_container;
/**
* @var language
diff --git a/phpBB/phpbb/console/command/user/activate.php b/phpBB/phpbb/console/command/user/activate.php
index 9c85718b4c..dc87f6d2db 100644
--- a/phpBB/phpbb/console/command/user/activate.php
+++ b/phpBB/phpbb/console/command/user/activate.php
@@ -15,7 +15,6 @@ namespace phpbb\console\command\user;
use phpbb\config\config;
use phpbb\console\command\command;
-use phpbb\db\driver\driver_interface;
use phpbb\language\language;
use phpbb\log\log_interface;
use phpbb\notification\manager;
@@ -29,9 +28,6 @@ use Symfony\Component\Console\Style\SymfonyStyle;
class activate extends command
{
- /** @var driver_interface */
- protected $db;
-
/** @var config */
protected $config;
@@ -65,7 +61,6 @@ class activate extends command
* Construct method
*
* @param user $user
- * @param driver_interface $db
* @param config $config
* @param language $language
* @param log_interface $log
@@ -74,9 +69,8 @@ class activate extends command
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(user $user, driver_interface $db, config $config, language $language, log_interface $log, manager $notifications, user_loader $user_loader, $phpbb_root_path, $php_ext)
+ public function __construct(user $user, config $config, language $language, log_interface $log, manager $notifications, user_loader $user_loader, $phpbb_root_path, $php_ext)
{
- $this->db = $db;
$this->config = $config;
$this->language = $language;
$this->log = $log;
diff --git a/phpBB/phpbb/console/command/user/delete.php b/phpBB/phpbb/console/command/user/delete.php
index 8593541c1a..dc06633fae 100644
--- a/phpBB/phpbb/console/command/user/delete.php
+++ b/phpBB/phpbb/console/command/user/delete.php
@@ -14,7 +14,6 @@
namespace phpbb\console\command\user;
use phpbb\console\command\command;
-use phpbb\db\driver\driver_interface;
use phpbb\language\language;
use phpbb\log\log_interface;
use phpbb\user;
@@ -28,9 +27,6 @@ use Symfony\Component\Console\Style\SymfonyStyle;
class delete extends command
{
- /** @var driver_interface */
- protected $db;
-
/** @var language */
protected $language;
@@ -58,16 +54,14 @@ class delete extends command
* Construct method
*
* @param user $user
- * @param driver_interface $db
* @param language $language
* @param log_interface $log
* @param user_loader $user_loader
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(user $user, driver_interface $db, language $language, log_interface $log, user_loader $user_loader, $phpbb_root_path, $php_ext)
+ public function __construct(user $user, language $language, log_interface $log, user_loader $user_loader, $phpbb_root_path, $php_ext)
{
- $this->db = $db;
$this->language = $language;
$this->log = $log;
$this->user_loader = $user_loader;
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index fbc56f3db2..77afec0306 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -61,6 +61,26 @@ class content_visibility
*/
protected $php_ext;
+ /**
+ * @var string
+ */
+ protected $forums_table;
+
+ /**
+ * @var string
+ */
+ protected $posts_table;
+
+ /**
+ * @var string
+ */
+ protected $topics_table;
+
+ /**
+ * @var string
+ */
+ protected $users_table;
+
/**
* Constructor
*
diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php
index f8dffc12de..70bcee36f2 100644
--- a/phpBB/phpbb/controller/resolver.php
+++ b/phpBB/phpbb/controller/resolver.php
@@ -30,7 +30,7 @@ class resolver implements ControllerResolverInterface
/**
* phpbb\template\template object
- * @var \phpbb\template\template
+ * @var \phpbb\template\template|null
*/
protected $template;
@@ -51,7 +51,7 @@ class resolver implements ControllerResolverInterface
*
* @param ContainerInterface $container ContainerInterface object
* @param string $phpbb_root_path Relative path to phpBB root
- * @param \phpbb\template\template $template
+ * @param \phpbb\template\template|null $template
*/
public function __construct(ContainerInterface $container, $phpbb_root_path, \phpbb\template\template $template = null)
{
diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php
index 59ee693074..f073721cc5 100644
--- a/phpBB/phpbb/cron/manager.php
+++ b/phpBB/phpbb/cron/manager.php
@@ -159,6 +159,6 @@ class manager
*/
public function wrap_task(\phpbb\cron\task\task $task)
{
- return new wrapper($task, $this->routing_helper, $this->phpbb_root_path, $this->php_ext);
+ return new wrapper($task, $this->routing_helper);
}
}
diff --git a/phpBB/phpbb/cron/task/text_reparser/reparser.php b/phpBB/phpbb/cron/task/text_reparser/reparser.php
index fa3bc67325..edfdbb4af6 100644
--- a/phpBB/phpbb/cron/task/text_reparser/reparser.php
+++ b/phpBB/phpbb/cron/task/text_reparser/reparser.php
@@ -26,11 +26,6 @@ class reparser extends \phpbb\cron\task\base
*/
protected $config;
- /**
- * @var \phpbb\config\db_text
- */
- protected $config_text;
-
/**
* @var \phpbb\lock\db
*/
@@ -60,15 +55,13 @@ class reparser extends \phpbb\cron\task\base
* Constructor
*
* @param \phpbb\config\config $config
- * @param \phpbb\config\db_text $config_text
* @param \phpbb\lock\db $reparse_lock
* @param \phpbb\textreparser\manager $reparser_manager
* @param \phpbb\di\service_collection $reparsers
*/
- public function __construct(\phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\lock\db $reparse_lock, \phpbb\textreparser\manager $reparser_manager, \phpbb\di\service_collection $reparsers)
+ public function __construct(\phpbb\config\config $config, \phpbb\lock\db $reparse_lock, \phpbb\textreparser\manager $reparser_manager, \phpbb\di\service_collection $reparsers)
{
$this->config = $config;
- $this->config_text = $config_text;
$this->reparse_lock = $reparse_lock;
$this->reparser_manager = $reparser_manager;
$this->reparsers = $reparsers;
diff --git a/phpBB/phpbb/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php
index 4dc3a7fb95..b0dac8217e 100644
--- a/phpBB/phpbb/cron/task/wrapper.php
+++ b/phpBB/phpbb/cron/task/wrapper.php
@@ -31,16 +31,6 @@ class wrapper
*/
protected $task;
- /**
- * @var string
- */
- protected $phpbb_root_path;
-
- /**
- * @var string
- */
- protected $php_ext;
-
/**
* Constructor.
*
@@ -48,15 +38,11 @@ class wrapper
*
* @param task $task The cron task to wrap.
* @param helper $routing_helper Routing helper for route generation
- * @param string $phpbb_root_path Relative path to phpBB root
- * @param string $php_ext PHP file extension
*/
- public function __construct(task $task, helper $routing_helper, $phpbb_root_path, $php_ext)
+ public function __construct(task $task, helper $routing_helper)
{
$this->task = $task;
$this->routing_helper = $routing_helper;
- $this->phpbb_root_path = $phpbb_root_path;
- $this->php_ext = $php_ext;
}
/**
@@ -96,6 +82,7 @@ class wrapper
*/
public function get_url()
{
+ $params = [];
$params['cron_type'] = $this->get_name();
if ($this->is_parametrized())
{
diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php
index 4b799b6219..5a191e2260 100644
--- a/phpBB/phpbb/datetime.php
+++ b/phpBB/phpbb/datetime.php
@@ -40,7 +40,7 @@ class datetime extends \DateTime
*
* @param user $user object for context.
* @param string $time String in a format accepted by strtotime().
- * @param \DateTimeZone $timezone Time zone of the time.
+ * @param \DateTimeZone|null $timezone Time zone of the time.
*/
public function __construct($user, $time = 'now', \DateTimeZone $timezone = null)
{
diff --git a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
index 648ae9ce96..3ca428e63d 100644
--- a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
+++ b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
@@ -46,7 +46,7 @@ class local_url_bbcode extends \phpbb\db\migration\migration
{
if (function_exists('phpbb_require_updated'))
{
- phpbb_require_updated('includes/acp/acp_bbcodes.' . $this->php_ext);
+ phpbb_require_updated('includes/acp/acp_bbcodes.' . $this->php_ext, $this->phpbb_root_path);
}
else
{
diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
index 247ccc7a76..8117aa7f82 100644
--- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
@@ -121,7 +121,7 @@ class release_3_0_4_rc1 extends \phpbb\db\migration\migration
$sql_ary['field_show_profile'] = 1;
}
- $this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary);
+ $this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id']);
}
$this->db->sql_freeresult($result);
diff --git a/phpBB/phpbb/db/migration/data/v310/avatar_types.php b/phpBB/phpbb/db/migration/data/v310/avatar_types.php
index 117e93239d..e41d1ee4d9 100644
--- a/phpBB/phpbb/db/migration/data/v310/avatar_types.php
+++ b/phpBB/phpbb/db/migration/data/v310/avatar_types.php
@@ -16,7 +16,7 @@ namespace phpbb\db\migration\data\v310;
class avatar_types extends \phpbb\db\migration\migration
{
/**
- * @var avatar type map
+ * @var array avatar type map
*/
protected $avatar_type_map = array(
AVATAR_UPLOAD => 'avatar.driver.upload',
diff --git a/phpBB/phpbb/db/migration/data/v310/bot_update.php b/phpBB/phpbb/db/migration/data/v310/bot_update.php
index 39b16c68f8..c695cc678e 100644
--- a/phpBB/phpbb/db/migration/data/v310/bot_update.php
+++ b/phpBB/phpbb/db/migration/data/v310/bot_update.php
@@ -54,6 +54,7 @@ class bot_update extends \phpbb\db\migration\migration
if (!$group_row)
{
// default fallback, should never get here
+ $group_row = [];
$group_row['group_id'] = 6;
$group_row['group_colour'] = '9E8DA7';
}
diff --git a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
index d43d432dd9..c15a184c9b 100644
--- a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
+++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
@@ -122,7 +122,7 @@ class notification_options_reconvert extends \phpbb\db\migration\migration
* @param string $item_type
* @param int $item_id
* @param int $user_id
- * @param string $methods
+ * @param array $methods
*/
protected function add_method_rows(\phpbb\db\sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods)
{
diff --git a/phpBB/phpbb/db/migration/data/v31x/style_update.php b/phpBB/phpbb/db/migration/data/v31x/style_update.php
index bb030bbe6d..a5f99b5d28 100644
--- a/phpBB/phpbb/db/migration/data/v31x/style_update.php
+++ b/phpBB/phpbb/db/migration/data/v31x/style_update.php
@@ -83,7 +83,7 @@ class style_update extends \phpbb\db\migration\migration
// Set prosilver to default style
$this->config->set('default_style', $style_id);
}
- else if (empty($styles) && empty($available_styles))
+ else if (empty($styles) && empty($style_paths))
{
throw new \RuntimeException('No valid styles available');
}
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php
index 93c338437e..f33172a708 100644
--- a/phpBB/phpbb/db/migration/tool/module.php
+++ b/phpBB/phpbb/db/migration/tool/module.php
@@ -20,9 +20,6 @@ use phpbb\module\exception\module_exception;
*/
class module implements \phpbb\db\migration\tool\tool_interface
{
- /** @var \phpbb\cache\service */
- protected $cache;
-
/** @var \phpbb\db\driver\driver_interface */
protected $db;
@@ -32,12 +29,6 @@ class module implements \phpbb\db\migration\tool\tool_interface
/** @var \phpbb\module\module_manager */
protected $module_manager;
- /** @var string */
- protected $phpbb_root_path;
-
- /** @var string */
- protected $php_ext;
-
/** @var string */
protected $modules_table;
@@ -48,21 +39,15 @@ class module implements \phpbb\db\migration\tool\tool_interface
* Constructor
*
* @param \phpbb\db\driver\driver_interface $db
- * @param \phpbb\cache\service $cache
* @param \phpbb\user $user
* @param \phpbb\module\module_manager $module_manager
- * @param string $phpbb_root_path
- * @param string $php_ext
* @param string $modules_table
*/
- public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\user $user, \phpbb\module\module_manager $module_manager, $phpbb_root_path, $php_ext, $modules_table)
+ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\module\module_manager $module_manager, $modules_table)
{
$this->db = $db;
- $this->cache = $cache;
$this->user = $user;
$this->module_manager = $module_manager;
- $this->phpbb_root_path = $phpbb_root_path;
- $this->php_ext = $php_ext;
$this->modules_table = $modules_table;
}
diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php
index 6d19ad94c9..83ce37cf34 100644
--- a/phpBB/phpbb/db/migration/tool/permission.php
+++ b/phpBB/phpbb/db/migration/tool/permission.php
@@ -115,9 +115,6 @@ class permission implements \phpbb\db\migration\tool\tool_interface
return;
}
- // We've added permissions, so set to true to notify the user.
- $this->permissions_added = true;
-
if (!class_exists('auth_admin'))
{
include($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext);
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index ca9128fdac..70ddb22309 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -50,6 +50,9 @@ class migrator
/** @var array */
protected $tables;
+ /** @var array */
+ protected $tools;
+
/** @var string */
protected $phpbb_root_path;
@@ -87,7 +90,7 @@ class migrator
*
* 'effectively_installed' set and set to true if the migration was effectively_installed
*
- * @var array
+ * @var array|bool
*/
protected $last_run_migration = false;
@@ -130,6 +133,7 @@ class migrator
$this->output_handler = new null_migrator_output_handler();
+ $this->tools = [];
foreach ($tools as $tool)
{
$this->tools[$tool->get_name()] = $tool;
@@ -699,7 +703,7 @@ class migrator
}
// Reverse the step that was run
- $result = $this->run_step($reverse_step, false, !$revert);
+ $this->run_step($reverse_step, false, !$revert);
}
throw $e;
diff --git a/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php
index e4bd3ac8e0..68ea43e5cf 100644
--- a/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php
+++ b/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php
@@ -31,7 +31,7 @@ class log_wrapper_migrator_output_handler implements migrator_output_handler_int
/**
* Log file handle
- * @var resource
+ * @var resource|bool
*/
protected $file_handle = false;
diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php
index 8c9de48823..6274f0f020 100644
--- a/phpBB/phpbb/di/extension/config.php
+++ b/phpBB/phpbb/di/extension/config.php
@@ -21,7 +21,7 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
*/
class config extends Extension
{
- /** @var array */
+ /** @var \phpbb\config_php_file */
protected $config_php;
public function __construct(\phpbb\config_php_file $config_php)
diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php
index 6298670c42..87062dab6c 100644
--- a/phpBB/phpbb/di/service_collection.php
+++ b/phpBB/phpbb/di/service_collection.php
@@ -93,7 +93,7 @@ class service_collection extends \ArrayObject
* Returns the service associated to a class
*
* @return mixed
- * @throw \RuntimeException if the
+ * @throws \RuntimeException if the service isn't found
*/
public function get_by_class($class)
{
diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php
index 1a2d7c989e..e2d3458ae3 100644
--- a/phpBB/phpbb/event/md_exporter.php
+++ b/phpBB/phpbb/event/md_exporter.php
@@ -39,6 +39,9 @@ class md_exporter
/** @var array */
protected $events;
+ /** @var array */
+ protected $events_by_file;
+
/**
* @param string $phpbb_root_path
* @param mixed $extension String 'vendor/ext' to filter, null for phpBB core
@@ -203,7 +206,7 @@ class md_exporter
if (!$this->version_is_filtered($since))
{
$is_filtered = false;
- foreach ($changes as $version => $null)
+ foreach (array_keys($changes) as $version)
{
if ($this->version_is_filtered($version))
{
diff --git a/phpBB/phpbb/exception/http_exception.php b/phpBB/phpbb/exception/http_exception.php
index 0e6ffe4f59..cae4a282d4 100644
--- a/phpBB/phpbb/exception/http_exception.php
+++ b/phpBB/phpbb/exception/http_exception.php
@@ -40,7 +40,7 @@ class http_exception extends runtime_exception implements HttpExceptionInterface
* @param integer $status_code The http status code.
* @param string $message The Exception message to throw (must be a language variable).
* @param array $parameters The parameters to use with the language var.
- * @param \Exception $previous The previous exception used for the exception chaining.
+ * @param \Exception|null $previous The previous exception used for the exception chaining.
* @param array $headers Additional headers to set in the response.
* @param integer $code The Exception code.
*/
diff --git a/phpBB/phpbb/exception/runtime_exception.php b/phpBB/phpbb/exception/runtime_exception.php
index 6568bbf86f..ccf0d84f32 100644
--- a/phpBB/phpbb/exception/runtime_exception.php
+++ b/phpBB/phpbb/exception/runtime_exception.php
@@ -32,7 +32,7 @@ class runtime_exception extends \RuntimeException implements exception_interface
*
* @param string $message The Exception message to throw (must be a language variable).
* @param array $parameters The parameters to use with the language var.
- * @param \Exception $previous The previous runtime_exception used for the runtime_exception chaining.
+ * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
* @param integer $code The Exception code.
*/
public function __construct($message = "", array $parameters = array(), \Exception $previous = null, $code = 0)
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php
index c7778cfed1..c056ab8bb3 100644
--- a/phpBB/phpbb/extension/base.php
+++ b/phpBB/phpbb/extension/base.php
@@ -35,7 +35,7 @@ class base implements \phpbb\extension\extension_interface
/** @var string */
protected $extension_path;
- /** @var string[] */
+ /** @var string[]|bool */
private $migrations = false;
/**
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index ecbb6c270e..48d0fb6c92 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -43,7 +43,7 @@ class manager
* @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension, defaults to php
- * @param \phpbb\cache\service $cache A cache instance or null
+ * @param \phpbb\cache\service|null $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext
*/
public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\service $cache = null, $cache_name = '_ext')
diff --git a/phpBB/phpbb/feed/controller/feed.php b/phpBB/phpbb/feed/controller/feed.php
index 0096d46eda..e36cbd83f8 100644
--- a/phpBB/phpbb/feed/controller/feed.php
+++ b/phpBB/phpbb/feed/controller/feed.php
@@ -290,7 +290,7 @@ class feed
*
* @return Response
*
- * @throw exception\feed_exception
+ * @throws exception\feed_exception
*/
protected function send_feed_do(feed_interface $feed)
{
@@ -401,7 +401,7 @@ class feed
/**
* Throw and exception saying that the feed isn't available
*
- * @throw http_exception
+ * @throws http_exception
*/
protected function send_unavailable()
{
diff --git a/phpBB/phpbb/feed/feed_interface.php b/phpBB/phpbb/feed/feed_interface.php
index c185cd249c..a548e2f5ea 100644
--- a/phpBB/phpbb/feed/feed_interface.php
+++ b/phpBB/phpbb/feed/feed_interface.php
@@ -61,7 +61,6 @@ interface feed_interface
*
* @param $item_row
* @param $row
- * @return array
*/
public function adjust_item(&$item_row, &$row);
}
diff --git a/phpBB/phpbb/files/filespec.php b/phpBB/phpbb/files/filespec.php
index d6d753024b..273b519adc 100644
--- a/phpBB/phpbb/files/filespec.php
+++ b/phpBB/phpbb/files/filespec.php
@@ -18,6 +18,8 @@ use phpbb\language\language;
/**
* Responsible for holding all file relevant information, as well as doing file-specific operations.
* The {@link fileupload fileupload class} can be used to upload several files, each of them being this object to operate further on.
+ *
+ * @deprecated 4.0.0 Use phpbb\files\filespec_storage instead
*/
class filespec
{
@@ -84,10 +86,10 @@ class filespec
/** @var string phpBB root path */
protected $phpbb_root_path;
- /** @var \phpbb\plupload\plupload The plupload object */
+ /** @var \phpbb\plupload\plupload|null The plupload object */
protected $plupload;
- /** @var \phpbb\mimetype\guesser phpBB Mimetype guesser */
+ /** @var \phpbb\mimetype\guesser|null phpBB Mimetype guesser */
protected $mimetype_guesser;
/**
@@ -98,8 +100,8 @@ class filespec
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param \FastImageSize\FastImageSize $imagesize Imagesize class
* @param string $phpbb_root_path phpBB root path
- * @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser
- * @param \phpbb\plupload\plupload $plupload Plupload
+ * @param \phpbb\mimetype\guesser|null $mimetype_guesser Mime type guesser
+ * @param \phpbb\plupload\plupload|null $plupload Plupload
*/
public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
diff --git a/phpBB/phpbb/files/filespec_storage.php b/phpBB/phpbb/files/filespec_storage.php
index bc9d7bf6a1..fb83d82ffd 100644
--- a/phpBB/phpbb/files/filespec_storage.php
+++ b/phpBB/phpbb/files/filespec_storage.php
@@ -66,34 +66,29 @@ class filespec_storage
/** @var upload Instance of upload class */
public $upload;
- /** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper class */
- protected $php_ini;
-
/** @var \FastImageSize\FastImageSize */
protected $imagesize;
/** @var language Language class */
protected $language;
- /** @var \phpbb\plupload\plupload The plupload object */
+ /** @var \phpbb\plupload\plupload|null The plupload object */
protected $plupload;
- /** @var \phpbb\mimetype\guesser phpBB Mimetype guesser */
+ /** @var \phpbb\mimetype\guesser|null phpBB Mimetype guesser */
protected $mimetype_guesser;
/**
* File upload class
*
* @param language $language Language
- * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param \FastImageSize\FastImageSize $imagesize Imagesize class
- * @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser
- * @param \phpbb\plupload\plupload $plupload Plupload
+ * @param \phpbb\mimetype\guesser|null $mimetype_guesser Mime type guesser
+ * @param \phpbb\plupload\plupload|null $plupload Plupload
*/
- public function __construct(language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
+ public function __construct(language $language, \FastImageSize\FastImageSize $imagesize, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
$this->language = $language;
- $this->php_ini = $php_ini;
$this->imagesize = $imagesize;
$this->plupload = $plupload;
$this->mimetype_guesser = $mimetype_guesser;
diff --git a/phpBB/phpbb/files/types/local.php b/phpBB/phpbb/files/types/local.php
index 67948ea6df..ca526c1a01 100644
--- a/phpBB/phpbb/files/types/local.php
+++ b/phpBB/phpbb/files/types/local.php
@@ -99,7 +99,7 @@ class local extends base
* Retrieve upload array
*
* @param string $source_file Source file name
- * @param array $filedata File data array
+ * @param array|bool $filedata File data array
*
* @return array Upload array
*/
diff --git a/phpBB/phpbb/files/types/local_storage.php b/phpBB/phpbb/files/types/local_storage.php
index c3990fe389..f68d51199e 100644
--- a/phpBB/phpbb/files/types/local_storage.php
+++ b/phpBB/phpbb/files/types/local_storage.php
@@ -108,7 +108,7 @@ class local_storage extends base
* Retrieve upload array
*
* @param string $source_file Source file name
- * @param array $filedata File data array
+ * @param array|bool $filedata File data array
*
* @return array Upload array
*/
diff --git a/phpBB/phpbb/files/types/remote.php b/phpBB/phpbb/files/types/remote.php
index 17c3d7a614..5fce258113 100644
--- a/phpBB/phpbb/files/types/remote.php
+++ b/phpBB/phpbb/files/types/remote.php
@@ -29,7 +29,7 @@ class remote extends base
/** @var factory Files factory */
protected $factory;
- /** @var filesystem Filesystem temp */
+ /** @var temp Filesystem temp */
protected $temp;
/** @var language */
diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php
index 50e15c9844..534758f159 100644
--- a/phpBB/phpbb/files/upload.php
+++ b/phpBB/phpbb/files/upload.php
@@ -13,7 +13,6 @@
namespace phpbb\files;
-use phpbb\filesystem\filesystem_interface;
use phpbb\language\language;
use phpbb\request\request_interface;
@@ -50,9 +49,6 @@ class upload
/** @var int Timeout for remote upload */
public $upload_timeout = 6;
- /** @var filesystem_interface */
- protected $filesystem;
-
/** @var \phpbb\files\factory Files factory */
protected $factory;
@@ -68,15 +64,13 @@ class upload
/**
* Init file upload class.
*
- * @param filesystem_interface $filesystem
* @param factory $factory Files factory
* @param language $language Language class
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param request_interface $request Request class
*/
- public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request)
+ public function __construct(factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request)
{
- $this->filesystem = $filesystem;
$this->factory = $factory;
$this->language = $language;
$this->php_ini = $php_ini;
@@ -98,13 +92,13 @@ class upload
/**
* Set allowed extensions
*
- * @param array $allowed_extensions Allowed file extensions
+ * @param array|bool $allowed_extensions Allowed file extensions
*
* @return \phpbb\files\upload This instance of upload
*/
public function set_allowed_extensions($allowed_extensions)
{
- if ($allowed_extensions !== false && is_array($allowed_extensions))
+ if ($allowed_extensions !== false)
{
$this->allowed_extensions = $allowed_extensions;
}
@@ -152,13 +146,13 @@ class upload
/**
* Set disallowed strings
*
- * @param array $disallowed_content Disallowed content
+ * @param array|bool $disallowed_content Disallowed content
*
* @return \phpbb\files\upload This instance of upload
*/
public function set_disallowed_content($disallowed_content)
{
- if ($disallowed_content !== false && is_array($disallowed_content))
+ if ($disallowed_content !== false)
{
$this->disallowed_content = array_diff($disallowed_content, array(''));
}
@@ -185,7 +179,7 @@ class upload
*
* @param string $type Upload type
*
- * @return \phpbb\files\filespec|bool A filespec instance if upload was
+ * @return \phpbb\files\filespec_storage|bool A filespec instance if upload was
* successful, false if there were issues or the type is not supported
*/
public function handle_upload($type)
@@ -259,7 +253,7 @@ class upload
/**
* Perform common file checks
*
- * @param filespec $file Instance of filespec class
+ * @param filespec_storage $file Instance of filespec class
*/
public function common_checks($file)
{
@@ -293,7 +287,7 @@ class upload
/**
* Check for allowed extension
*
- * @param filespec $file Instance of filespec class
+ * @param filespec_storage $file Instance of filespec class
*
* @return bool True if extension is allowed, false if not
*/
@@ -305,7 +299,7 @@ class upload
/**
* Check for allowed dimension
*
- * @param filespec $file Instance of filespec class
+ * @param filespec_storage $file Instance of filespec class
*
* @return bool True if dimensions are valid or no constraints set, false
* if not
@@ -346,7 +340,7 @@ class upload
/**
* Check for bad content (IE mime-sniffing)
*
- * @param filespec $file Instance of filespec class
+ * @param filespec_storage $file Instance of filespec class
*
* @return bool True if content is valid, false if not
*/
diff --git a/phpBB/phpbb/filesystem/exception/filesystem_exception.php b/phpBB/phpbb/filesystem/exception/filesystem_exception.php
index ddff8046e5..55ea3625a5 100644
--- a/phpBB/phpbb/filesystem/exception/filesystem_exception.php
+++ b/phpBB/phpbb/filesystem/exception/filesystem_exception.php
@@ -20,11 +20,11 @@ class filesystem_exception extends runtime_exception
/**
* Constructor
*
- * @param string $message The Exception message to throw (must be a language variable).
- * @param string $filename The file that caused the error.
- * @param array $parameters The parameters to use with the language var.
- * @param \Exception $previous The previous runtime_exception used for the runtime_exception chaining.
- * @param integer $code The Exception code.
+ * @param string $message The Exception message to throw (must be a language variable).
+ * @param string $filename The file that caused the error.
+ * @param array $parameters The parameters to use with the language var.
+ * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
+ * @param integer $code The Exception code.
*/
public function __construct($message = '', $filename = '', $parameters = array(), \Exception $previous = null, $code = 0)
{
diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php
index b87f43a8d4..cd29b029f2 100644
--- a/phpBB/phpbb/filesystem/filesystem.php
+++ b/phpBB/phpbb/filesystem/filesystem.php
@@ -31,7 +31,7 @@ class filesystem implements filesystem_interface
/**
* Stores current working directory
*
- * @var string|bool current working directory or false if it cannot be recovered
+ * @var string|bool|null current working directory or false if it cannot be recovered
*/
protected $working_directory;
diff --git a/phpBB/phpbb/filesystem/filesystem_interface.php b/phpBB/phpbb/filesystem/filesystem_interface.php
index 139cd27ef6..6d0d35d72f 100644
--- a/phpBB/phpbb/filesystem/filesystem_interface.php
+++ b/phpBB/phpbb/filesystem/filesystem_interface.php
@@ -177,14 +177,14 @@ interface filesystem_interface
/**
* Mirrors a directory to another.
*
- * @param string $origin_dir The origin directory
- * @param string $target_dir The target directory
- * @param \Traversable $iterator A Traversable instance
- * @param array $options An array of boolean options
- * Valid options are:
- * - $options['override'] Whether to override an existing file on copy or not (see copy())
- * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink())
- * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false)
+ * @param string $origin_dir The origin directory
+ * @param string $target_dir The target directory
+ * @param \Traversable|null $iterator A Traversable instance
+ * @param array $options An array of boolean options
+ * Valid options are:
+ * - $options['override'] Whether to override an existing file on copy or not (see copy())
+ * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink())
+ * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false)
*
* @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be copied.
* The filename which triggered the error can be
diff --git a/phpBB/phpbb/filesystem/helper.php b/phpBB/phpbb/filesystem/helper.php
index f73dd7f2f5..24103e8318 100644
--- a/phpBB/phpbb/filesystem/helper.php
+++ b/phpBB/phpbb/filesystem/helper.php
@@ -233,7 +233,7 @@ class helper
$path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
}
- trim($path, '/');
+ //$path = trim($path, '/'); // TODO: Check this
$path_parts = explode('/', $path);
$resolved = array();
$resolved_path = $prefix;
diff --git a/phpBB/phpbb/finder.php b/phpBB/phpbb/finder.php
index 19056318f8..1815377a7d 100644
--- a/phpBB/phpbb/finder.php
+++ b/phpBB/phpbb/finder.php
@@ -50,7 +50,7 @@ class finder
* Creates a new finder instance with its dependencies
*
* @param string $phpbb_root_path Path to the phpbb root directory
- * @param \phpbb\cache\service $cache A cache instance or null
+ * @param \phpbb\cache\service|null $cache A cache instance or null
* @param string $php_ext php file extension
* @param string $cache_name The name of the cache variable, defaults to
* _ext_finder
diff --git a/phpBB/phpbb/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php
index efea3389d4..3e50df89be 100644
--- a/phpBB/phpbb/groupposition/legend.php
+++ b/phpBB/phpbb/groupposition/legend.php
@@ -32,22 +32,15 @@ class legend implements \phpbb\groupposition\groupposition_interface
*/
protected $db;
- /**
- * User object
- * @var \phpbb\user
- */
- protected $user;
/**
* Constructor
*
* @param \phpbb\db\driver\driver_interface $db Database object
- * @param \phpbb\user $user User object
*/
- public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user)
+ public function __construct(\phpbb\db\driver\driver_interface $db)
{
$this->db = $db;
- $this->user = $user;
}
/**
diff --git a/phpBB/phpbb/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php
index 2985c51525..7740f90478 100644
--- a/phpBB/phpbb/groupposition/teampage.php
+++ b/phpBB/phpbb/groupposition/teampage.php
@@ -36,12 +36,6 @@ class teampage implements \phpbb\groupposition\groupposition_interface
*/
protected $db;
- /**
- * User object
- * @var \phpbb\user
- */
- protected $user;
-
/**
* Cache object
* @var \phpbb\cache\driver\driver_interface
@@ -52,13 +46,11 @@ class teampage implements \phpbb\groupposition\groupposition_interface
* Constructor
*
* @param \phpbb\db\driver\driver_interface $db Database object
- * @param \phpbb\user $user User object
* @param \phpbb\cache\driver\driver_interface $cache Cache object
*/
- public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache)
+ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache)
{
$this->db = $db;
- $this->user = $user;
$this->cache = $cache;
}
diff --git a/phpBB/phpbb/install/controller/update.php b/phpBB/phpbb/install/controller/update.php
index 6b88827940..711a726302 100644
--- a/phpBB/phpbb/install/controller/update.php
+++ b/phpBB/phpbb/install/controller/update.php
@@ -21,6 +21,7 @@ use phpbb\install\installer;
use phpbb\language\language;
use phpbb\request\request_interface;
use phpbb\template\template;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
/**
diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php
index 077a4fabe5..4e843fd7fc 100644
--- a/phpBB/phpbb/install/helper/container_factory.php
+++ b/phpBB/phpbb/install/helper/container_factory.php
@@ -47,7 +47,7 @@ class container_factory
/**
* The full phpBB container
*
- * @var \Symfony\Component\DependencyInjection\ContainerInterface
+ * @var \Symfony\Component\DependencyInjection\ContainerInterface|null
*/
protected $container;
diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php
index f495b47496..9895dd733c 100644
--- a/phpBB/phpbb/install/helper/database.php
+++ b/phpBB/phpbb/install/helper/database.php
@@ -388,6 +388,7 @@ class database
OR PARAMETER = 'NLS_CHARACTERSET'";
$result = $db->sql_query($sql);
+ $stats = [];
while ($row = $db->sql_fetchrow($result))
{
$stats[$row['parameter']] = $row['value'];
diff --git a/phpBB/phpbb/install/helper/file_updater/compression_file_updater.php b/phpBB/phpbb/install/helper/file_updater/compression_file_updater.php
index ede992fb6e..c1044a3a1f 100644
--- a/phpBB/phpbb/install/helper/file_updater/compression_file_updater.php
+++ b/phpBB/phpbb/install/helper/file_updater/compression_file_updater.php
@@ -21,7 +21,7 @@ use phpbb\install\helper\update_helper;
class compression_file_updater implements file_updater_interface
{
/**
- * @var \compress
+ * @var \compress|null
*/
protected $compress;
diff --git a/phpBB/phpbb/install/helper/file_updater/ftp_file_updater.php b/phpBB/phpbb/install/helper/file_updater/ftp_file_updater.php
index 5cdc331cbc..4e4842693d 100644
--- a/phpBB/phpbb/install/helper/file_updater/ftp_file_updater.php
+++ b/phpBB/phpbb/install/helper/file_updater/ftp_file_updater.php
@@ -21,7 +21,7 @@ use phpbb\install\helper\update_helper;
class ftp_file_updater implements file_updater_interface
{
/**
- * @var \transfer
+ * @var \transfer|null
*/
protected $transfer;
diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php
index 4117a3dfd3..9553b11d34 100644
--- a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php
+++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php
@@ -38,7 +38,7 @@ class cli_iohandler extends iohandler_base
protected $input_values = array();
/**
- * @var \Symfony\Component\Console\Helper\ProgressBar
+ * @var \Symfony\Component\Console\Helper\ProgressBar|null
*/
protected $progress_bar;
diff --git a/phpBB/phpbb/install/helper/iohandler/factory.php b/phpBB/phpbb/install/helper/iohandler/factory.php
index 1e8395760a..403a5fed75 100644
--- a/phpBB/phpbb/install/helper/iohandler/factory.php
+++ b/phpBB/phpbb/install/helper/iohandler/factory.php
@@ -26,7 +26,7 @@ class factory
protected $container;
/**
- * @var string
+ * @var string|null
*/
protected $environment;
diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php
index e04e233a76..4baf888506 100644
--- a/phpBB/phpbb/install/installer.php
+++ b/phpBB/phpbb/install/installer.php
@@ -45,7 +45,7 @@ class installer
protected $install_config;
/**
- * @var ordered_service_collection
+ * @var ordered_service_collection|null
*/
protected $installer_modules;
diff --git a/phpBB/phpbb/install/module/install_data/task/add_modules.php b/phpBB/phpbb/install/module/install_data/task/add_modules.php
index b64f4c31db..3dfdab356c 100644
--- a/phpBB/phpbb/install/module/install_data/task/add_modules.php
+++ b/phpBB/phpbb/install/module/install_data/task/add_modules.php
@@ -30,11 +30,6 @@ class add_modules extends \phpbb\install\task_base
*/
protected $db;
- /**
- * @var \phpbb\extension\manager
- */
- protected $extension_manager;
-
/**
* @var \phpbb\install\helper\iohandler\iohandler_interface
*/
@@ -154,7 +149,6 @@ class add_modules extends \phpbb\install\task_base
{
$this->config = $config;
$this->db = $container->get('dbal.conn');
- $this->extension_manager = $container->get('ext.manager');
$this->iohandler = $iohandler;
$this->module_manager = $container->get('module.manager');
diff --git a/phpBB/phpbb/install/module/install_data/task/create_search_index.php b/phpBB/phpbb/install/module/install_data/task/create_search_index.php
index 8a2f6aa1de..1a9480de75 100644
--- a/phpBB/phpbb/install/module/install_data/task/create_search_index.php
+++ b/phpBB/phpbb/install/module/install_data/task/create_search_index.php
@@ -18,7 +18,6 @@ use phpbb\db\driver\driver_interface;
use phpbb\event\dispatcher;
use phpbb\config\config;
use phpbb\install\helper\container_factory;
-use phpbb\language\language;
use phpbb\search\fulltext_native;
use phpbb\user;
@@ -44,11 +43,6 @@ class create_search_index extends \phpbb\install\task_base
*/
protected $phpbb_dispatcher;
- /**
- * @var language
- */
- protected $language;
-
/**
* @var user
*/
@@ -78,7 +72,6 @@ class create_search_index extends \phpbb\install\task_base
$this->auth = $container->get('auth');
$this->config = $config;
$this->db = $container->get('dbal.conn');
- $this->language = $container->get('language');
$this->phpbb_dispatcher = $container->get('dispatcher');
$this->user = $container->get('user');
diff --git a/phpBB/phpbb/install/module/install_database/task/add_tables.php b/phpBB/phpbb/install/module/install_database/task/add_tables.php
index dc814f36ef..c5ecdaa6cb 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_tables.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_tables.php
@@ -35,11 +35,6 @@ class add_tables extends \phpbb\install\task_base
*/
protected $db_tools;
- /**
- * @var \phpbb\filesystem\filesystem_interface
- */
- protected $filesystem;
-
/**
* @var string
*/
@@ -50,12 +45,10 @@ class add_tables extends \phpbb\install\task_base
*
* @param \phpbb\install\helper\config $config
* @param \phpbb\install\helper\database $db_helper
- * @param \phpbb\filesystem\filesystem_interface $filesystem
* @param string $phpbb_root_path
*/
public function __construct(\phpbb\install\helper\config $config,
\phpbb\install\helper\database $db_helper,
- \phpbb\filesystem\filesystem_interface $filesystem,
$phpbb_root_path)
{
$dbms = $db_helper->get_available_dbms($config->get('dbms'));
@@ -75,7 +68,6 @@ class add_tables extends \phpbb\install\task_base
$this->config = $config;
$this->db_tools = $factory->get($this->db);
- $this->filesystem = $filesystem;
$this->schema_file_path = $phpbb_root_path . 'store/schema.json';
parent::__construct(true);
diff --git a/phpBB/phpbb/install/module/install_finish/task/notify_user.php b/phpBB/phpbb/install/module/install_finish/task/notify_user.php
index b045b708db..8b9ac41910 100644
--- a/phpBB/phpbb/install/module/install_finish/task/notify_user.php
+++ b/phpBB/phpbb/install/module/install_finish/task/notify_user.php
@@ -40,11 +40,6 @@ class notify_user extends \phpbb\install\task_base
*/
protected $config;
- /**
- * @var \phpbb\language\language
- */
- protected $language;
-
/**
* @var \phpbb\log\log_interface
*/
@@ -80,7 +75,6 @@ class notify_user extends \phpbb\install\task_base
$this->iohandler = $iohandler;
$this->auth = $container->get('auth');
- $this->language = $container->get('language');
$this->log = $container->get('log');
$this->user = $container->get('user');
$this->phpbb_root_path = $phpbb_root_path;
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php
index 6ec1e612b9..85c5e06522 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php
@@ -79,7 +79,7 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in
$dbhost = $this->io_handler->get_input('dbhost', '', true);
$dbport = $this->io_handler->get_input('dbport', '');
$dbuser = $this->io_handler->get_input('dbuser', '', true);
- $dbpasswd = $this->io_handler->get_raw_input('dbpasswd', '', true);
+ $dbpasswd = $this->io_handler->get_raw_input('dbpasswd', '');
$dbname = $this->io_handler->get_input('dbname', '', true);
$table_prefix = $this->io_handler->get_input('table_prefix', '', true);
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php
index d5a8855c37..3e890b2954 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php
@@ -126,6 +126,8 @@ class obtain_file_updater_method extends task_base
*/
protected function get_available_compression_methods()
{
+ $methods = [];
+
$methods[] = array(
'value' => '.tar',
'label' => '.tar',
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
index 3b24e8ba40..9a2e14a937 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
@@ -67,10 +67,12 @@ class obtain_update_settings extends task_base
{
if ($this->installer_config->get('disable_filesystem_update', false))
{
- $options[] = array(
- 'value' => 'db_only',
- 'label' => 'UPDATE_TYPE_DB_ONLY',
- 'selected' => true,
+ $options = array(
+ array(
+ 'value' => 'db_only',
+ 'label' => 'UPDATE_TYPE_DB_ONLY',
+ 'selected' => true,
+ ),
);
}
else
diff --git a/phpBB/phpbb/install/module/update_filesystem/task/update_files.php b/phpBB/phpbb/install/module/update_filesystem/task/update_files.php
index fbb465cc66..d54d0afca9 100644
--- a/phpBB/phpbb/install/module/update_filesystem/task/update_files.php
+++ b/phpBB/phpbb/install/module/update_filesystem/task/update_files.php
@@ -49,7 +49,7 @@ class update_files extends task_base
protected $factory;
/**
- * @var file_updater_interface
+ * @var file_updater_interface|null
*/
protected $file_updater;
@@ -58,11 +58,6 @@ class update_files extends task_base
*/
protected $update_helper;
- /**
- * @var string
- */
- protected $phpbb_root_path;
-
/**
* Constructor
*
@@ -71,15 +66,13 @@ class update_files extends task_base
* @param iohandler_interface $iohandler
* @param factory $file_updater_factory
* @param update_helper $update_helper
- * @param string $phpbb_root_path
*/
- public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, factory $file_updater_factory, update_helper $update_helper, $phpbb_root_path)
+ public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, factory $file_updater_factory, update_helper $update_helper)
{
$this->factory = $file_updater_factory;
$this->installer_config = $config;
$this->iohandler = $iohandler;
$this->update_helper = $update_helper;
- $this->phpbb_root_path = $phpbb_root_path;
$this->cache = $container->get('cache.driver');
$this->file_updater = null;
diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php
index 1f6300fb70..bcb40504d8 100644
--- a/phpBB/phpbb/language/language.php
+++ b/phpBB/phpbb/language/language.php
@@ -41,12 +41,12 @@ class language
protected $common_language_files_loaded;
/**
- * @var string ISO code of the default board language
+ * @var string|null ISO code of the default board language
*/
protected $default_language;
/**
- * @var string ISO code of the User's language
+ * @var string|null ISO code of the User's language
*/
protected $user_language;
@@ -81,8 +81,8 @@ class language
$this->loader = $loader;
// Set up default information
- $this->user_language = false;
- $this->default_language = false;
+ $this->user_language = null;
+ $this->default_language = null;
$this->lang = array();
$this->loaded_language_sets = array(
'core' => array(),
@@ -112,7 +112,7 @@ class language
* @param string $user_lang_iso ISO code of the User's language
* @param bool $reload Whether or not to reload language files
*/
- public function set_user_language($user_lang_iso, $reload = false)
+ public function set_user_language(string $user_lang_iso, $reload = false)
{
$this->user_language = $user_lang_iso;
@@ -125,7 +125,7 @@ class language
* @param string $default_lang_iso ISO code of the board's default language
* @param bool $reload Whether or not to reload language files
*/
- public function set_default_language($default_lang_iso, $reload = false)
+ public function set_default_language(string $default_lang_iso, $reload = false)
{
$this->default_language = $default_lang_iso;
@@ -582,19 +582,17 @@ class language
* Returns language fallback data
*
* @param bool $reload Whether or not to reload language files
- *
- * @return array
*/
protected function set_fallback_array($reload = false)
{
$fallback_array = array();
- if ($this->user_language)
+ if ($this->user_language !== null)
{
$fallback_array[] = $this->user_language;
}
- if ($this->default_language)
+ if ($this->default_language !== null)
{
$fallback_array[] = $this->default_language;
}
diff --git a/phpBB/phpbb/language/language_file_loader.php b/phpBB/phpbb/language/language_file_loader.php
index 2910dd3c4a..b064dd84a4 100644
--- a/phpBB/phpbb/language/language_file_loader.php
+++ b/phpBB/phpbb/language/language_file_loader.php
@@ -31,7 +31,7 @@ class language_file_loader
protected $php_ext;
/**
- * @var \phpbb\extension\manager Extension manager
+ * @var \phpbb\extension\manager|null Extension manager
*/
protected $extension_manager;
diff --git a/phpBB/phpbb/lock/flock.php b/phpBB/phpbb/lock/flock.php
index fc35c527bf..42ec8da030 100644
--- a/phpBB/phpbb/lock/flock.php
+++ b/phpBB/phpbb/lock/flock.php
@@ -27,7 +27,7 @@ class flock
/**
* File pointer for the lock file
- * @var string
+ * @var string|bool
*/
private $lock_fp;
@@ -41,7 +41,7 @@ class flock
public function __construct($path)
{
$this->path = $path;
- $this->lock_fp = null;
+ $this->lock_fp = false;
}
/**
@@ -138,7 +138,7 @@ class flock
{
@flock($this->lock_fp, LOCK_UN);
fclose($this->lock_fp);
- $this->lock_fp = null;
+ $this->lock_fp = false;
}
}
}
diff --git a/phpBB/phpbb/message/message.php b/phpBB/phpbb/message/message.php
index fa701d1c77..6b742d6c00 100644
--- a/phpBB/phpbb/message/message.php
+++ b/phpBB/phpbb/message/message.php
@@ -39,7 +39,7 @@ class message
protected $sender_address = '';
/** @var string */
protected $sender_lang = '';
- /** @var string */
+ /** @var string|int */
protected $sender_id = '';
/** @var string */
protected $sender_username = '';
diff --git a/phpBB/phpbb/mimetype/extension_guesser.php b/phpBB/phpbb/mimetype/extension_guesser.php
index 9e36c07f91..bbccf904d4 100644
--- a/phpBB/phpbb/mimetype/extension_guesser.php
+++ b/phpBB/phpbb/mimetype/extension_guesser.php
@@ -16,7 +16,7 @@ namespace phpbb\mimetype;
class extension_guesser extends guesser_base
{
/**
- * @var file extension map
+ * @var array file extension map
*/
protected $extension_map = array(
'3dm' => 'x-world/x-3dmf',
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index ace08e6cf6..33e787c6fa 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -70,8 +70,6 @@ class manager
* @param \phpbb\user $user
* @param string $notification_types_table
* @param string $user_notifications_table
- *
- * @return \phpbb\notification\manager
*/
public function __construct($notification_types, $notification_methods, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\language\language $language, \phpbb\user $user, $notification_types_table, $user_notifications_table)
{
@@ -919,6 +917,8 @@ class manager
*/
public function get_notification_type_id($notification_type_name)
{
+ $notification_type_ids = [];
+
$sql = 'SELECT notification_type_id, notification_type_name
FROM ' . $this->notification_types_table;
$result = $this->db->sql_query($sql, 604800); // cache for one week
diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php
index a9717e70df..c93a7625f1 100644
--- a/phpBB/phpbb/notification/method/email.php
+++ b/phpBB/phpbb/notification/method/email.php
@@ -69,7 +69,7 @@ class email extends \phpbb\notification\method\messenger_base
* Is this method available for the user?
* This is checked on the notifications options
*
- * @param type_interface $notification_type An optional instance of a notification type. If provided, this
+ * @param type_interface|null $notification_type An optional instance of a notification type. If provided, this
* method additionally checks if the type provides an email template.
* @return bool
*/
diff --git a/phpBB/phpbb/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php
index 81fdb378e2..d0b6a44eb6 100644
--- a/phpBB/phpbb/notification/method/jabber.php
+++ b/phpBB/phpbb/notification/method/jabber.php
@@ -59,7 +59,7 @@ class jabber extends \phpbb\notification\method\messenger_base
* Is this method available for the user?
* This is checked on the notifications options
*
- * @param type_interface $notification_type An optional instance of a notification type. If provided, this
+ * @param type_interface|null $notification_type An optional instance of a notification type. If provided, this
* method additionally checks if the type provides an email template.
* @return bool
*/
diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php
index f82017b70e..43030e2a5b 100644
--- a/phpBB/phpbb/notification/method/messenger_base.php
+++ b/phpBB/phpbb/notification/method/messenger_base.php
@@ -48,7 +48,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
* Is this method available for the user?
* This is checked on the notifications options
*
- * @param type_interface $notification_type An optional instance of a notification type. This method returns false
+ * @param type_interface|null $notification_type An optional instance of a notification type. This method returns false
* only if the type is provided and if it doesn't provide an email template.
* @return bool
*/
@@ -73,7 +73,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
}
// Load all users we want to notify (we need their email address)
- $user_ids = $users = array();
+ $user_ids = array();
foreach ($this->queue as $notification)
{
$user_ids[] = $notification->user_id;
diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php
index e4600add11..b5238a0e9a 100644
--- a/phpBB/phpbb/notification/type/base.php
+++ b/phpBB/phpbb/notification/type/base.php
@@ -175,7 +175,6 @@ abstract class base implements \phpbb\notification\type\type_interface
*
* @param string $name Name of the variable to set
* @param mixed $value Value to set to the variable
- * @return mixed
*/
protected function set_data($name, $value)
{
diff --git a/phpBB/phpbb/passwords/manager.php b/phpBB/phpbb/passwords/manager.php
index 54e6dce4be..58b115aab0 100644
--- a/phpBB/phpbb/passwords/manager.php
+++ b/phpBB/phpbb/passwords/manager.php
@@ -24,7 +24,7 @@ class manager
* Hashing algorithm type map
* Will be used to map hash prefix to type
*/
- protected $type_map = false;
+ protected $type_map = [];
/**
* Service collection of hashing algorithms
@@ -329,12 +329,12 @@ class manager
* Create combined hash from already hashed password
*
* @param string $password_hash Complete current password hash
- * @param string $type Type of the hashing algorithm the password hash
+ * @param array $type Type of the hashing algorithm the password hash
* should be combined with
* @return string|bool Combined password hash if combined hashing was
* successful, else false
*/
- public function combined_hash_password($password_hash, $type)
+ public function combined_hash_password($password_hash, array $type)
{
$this->initialize();
diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php
index a88e82d531..bf3b33856e 100644
--- a/phpBB/phpbb/permissions.php
+++ b/phpBB/phpbb/permissions.php
@@ -63,7 +63,7 @@ class permissions
* @since 3.1.0-a1
*/
$vars = array('types', 'categories', 'permissions');
- extract($phpbb_dispatcher->trigger_event('core.permissions', compact($vars)));
+ extract($this->dispatcher->trigger_event('core.permissions', compact($vars)));
$this->categories = $categories;
$this->types = $types;
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index 8af2fe12ad..714366f290 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -39,9 +39,6 @@ class manager
/** @var \phpbb\log\log */
protected $log;
- /** @var \phpbb\request\request */
- protected $request;
-
/** @var \phpbb\template\template */
protected $template;
@@ -76,7 +73,6 @@ class manager
* @param \phpbb\event\dispatcher_interface $dispatcher Event dispatcher object
* @param \phpbb\language\language $language Language object
* @param \phpbb\log\log $log Log object
- * @param \phpbb\request\request $request Request object
* @param \phpbb\template\template $template Template object
* @param \phpbb\di\service_collection $type_collection CPF Type collection
* @param \phpbb\user $user User object
@@ -93,7 +89,6 @@ class manager
\phpbb\event\dispatcher_interface $dispatcher,
\phpbb\language\language $language,
\phpbb\log\log $log,
- \phpbb\request\request $request,
\phpbb\template\template $template,
\phpbb\di\service_collection $type_collection,
\phpbb\user $user,
@@ -110,7 +105,6 @@ class manager
$this->dispatcher = $dispatcher;
$this->language = $language;
$this->log = $log;
- $this->request = $request;
$this->template = $template;
$this->type_collection = $type_collection;
$this->user = $user;
@@ -155,7 +149,7 @@ class manager
}
$sql = 'SELECT l.*, f.*
- FROM ' . $this->fields_lang_table . ' l,
+ FROM ' . $this->fields_lang_table . ' l,
' . $this->fields_table . ' f
WHERE l.field_id = f.field_id
AND f.field_active = 1
@@ -192,7 +186,7 @@ class manager
$sql_where = !$this->auth->acl_gets('a_', 'm_') && !$this->auth->acl_getf_global('m_') ? ' AND f.field_hide = 0' : '';
$sql = 'SELECT l.*, f.*
- FROM ' . $this->fields_lang_table . ' l,
+ FROM ' . $this->fields_lang_table . ' l,
' . $this->fields_table . ' f
WHERE l.field_id = f.field_id
AND f.field_active = 1
@@ -241,7 +235,7 @@ class manager
}
$sql = 'SELECT l.*, f.*
- FROM ' . $this->fields_lang_table . ' l,
+ FROM ' . $this->fields_lang_table . ' l,
' . $this->fields_table . ' f
WHERE l.field_id = f.field_id
AND f.field_active = 1
@@ -535,7 +529,7 @@ class manager
$length = strlen($prefix);
$not_in = [];
- foreach ($cp_data as $key => $null)
+ foreach (array_keys($cp_data) as $key)
{
$not_in[] = strncmp($key, $prefix, $length) === 0 ? substr($key, $length) : $key;
}
diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php
index d54404bbb4..a32de40558 100644
--- a/phpBB/phpbb/profilefields/type/type_dropdown.php
+++ b/phpBB/phpbb/profilefields/type/type_dropdown.php
@@ -68,6 +68,8 @@ class type_dropdown extends type_base
*/
public function get_options($default_lang_id, $field_data)
{
+ $profile_row = [];
+
$profile_row[0] = array(
'var_name' => 'field_default_value',
'field_id' => 1,
diff --git a/phpBB/phpbb/report/controller/report.php b/phpBB/phpbb/report/controller/report.php
index a8f4abf338..84be09e27b 100644
--- a/phpBB/phpbb/report/controller/report.php
+++ b/phpBB/phpbb/report/controller/report.php
@@ -59,7 +59,7 @@ class report
protected $php_ext;
/**
- * @var \phpbb\report\report_handler_interface
+ * @var \phpbb\report\handler_factory
*/
protected $report_handler;
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index d15f72a289..743735a226 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -20,17 +20,18 @@ use phpbb\filesystem\helper as filesystem_helper;
*/
class session
{
- var $cookie_data = array();
- var $page = array();
- var $data = array();
- var $browser = '';
- var $forwarded_for = '';
- var $host = '';
- var $session_id = '';
- var $ip = '';
- var $load = 0;
- var $time_now = 0;
- var $update_session_page = true;
+ public $cookie_data = array();
+ public $page = array();
+ public $data = array();
+ public $browser = '';
+ public $referer = '';
+ public $forwarded_for = '';
+ public $host = '';
+ public $session_id = '';
+ public $ip = '';
+ public $load = 0;
+ public $time_now = 0;
+ public $update_session_page = true;
/**
* Extract current session page
@@ -67,7 +68,7 @@ class session
$find = array('"', "'", '<', '>', '"', '<', '>');
$replace = array('%22', '%27', '%3C', '%3E', '%22', '%3C', '%3E');
- foreach ($args as $key => $argument)
+ foreach ($args as $argument)
{
if (strpos($argument, 'sid=') === 0)
{
@@ -1328,8 +1329,6 @@ class session
/**
* Check the current session for bans
- *
- * @return true if session user is banned.
*/
protected function check_ban_for_current_session($config)
{
@@ -1465,7 +1464,7 @@ class session
$user_ip = ($user_ip === false) ? $this->ip : $user_ip;
$key = ($key === false) ? (($this->cookie_data['k']) ? $this->cookie_data['k'] : false) : $key;
- $key_id = unique_id(hexdec(substr($this->session_id, 0, 8)));
+ $key_id = unique_id();
$sql_ary = array(
'key_id' => (string) md5($key_id),
diff --git a/phpBB/phpbb/storage/storage.php b/phpBB/phpbb/storage/storage.php
index 7ba26d6b95..93f81791cd 100644
--- a/phpBB/phpbb/storage/storage.php
+++ b/phpBB/phpbb/storage/storage.php
@@ -18,7 +18,7 @@ use phpbb\db\driver\driver_interface as db;
use phpbb\storage\exception\exception;
/**
- * @internal Experimental
+ * Experimental
*/
class storage
{
diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php
index eadd2b3273..b25a91b7b9 100644
--- a/phpBB/phpbb/tree/nestedset.php
+++ b/phpBB/phpbb/tree/nestedset.php
@@ -395,7 +395,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
$this->db->sql_transaction('begin');
- $this->remove_subset($move_items, $current_parent, false, true);
+ $this->remove_subset($move_items, $current_parent, false);
if ($new_parent_id)
{
@@ -414,7 +414,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
- $new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true);
+ $new_right_id = $this->prepare_adding_subset($move_items, $new_parent);
if ($new_right_id > $current_parent[$this->column_right_id])
{
@@ -493,7 +493,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
$this->db->sql_transaction('begin');
- $this->remove_subset($move_items, $item, false, true);
+ $this->remove_subset($move_items, $item, false);
if ($new_parent_id)
{
@@ -512,7 +512,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
- $new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true);
+ $new_right_id = $this->prepare_adding_subset($move_items, $new_parent);
if ($new_right_id > (int) $item[$this->column_right_id])
{
diff --git a/phpBB/phpbb/ucp/controller/reset_password.php b/phpBB/phpbb/ucp/controller/reset_password.php
index d20fafb2a8..07b36aecef 100644
--- a/phpBB/phpbb/ucp/controller/reset_password.php
+++ b/phpBB/phpbb/ucp/controller/reset_password.php
@@ -62,7 +62,7 @@ class reset_password
/** @var user */
protected $user;
- /** @var array phpBB DB table names */
+ /** @var string Users table name */
protected $users_table;
/** @var string phpBB root path */
diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php
index f622634b1a..b85f226497 100644
--- a/phpBB/phpbb/user.php
+++ b/phpBB/phpbb/user.php
@@ -51,6 +51,8 @@ class user extends \phpbb\session
// Able to add new options (up to id 31)
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17);
+ public $profile_fields;
+
/**
* Constructor to set the lang path
*
@@ -668,7 +670,7 @@ class user extends \phpbb\session
*
* @since 3.1
* @param string $time String in a format accepted by strtotime().
- * @param DateTimeZone $timezone Time zone of the time.
+ * @param DateTimeZone|null $timezone Time zone of the time.
* @return \phpbb\datetime Date time object linked to the current users locale
*/
public function create_datetime($time = 'now', \DateTimeZone $timezone = null)
@@ -682,7 +684,7 @@ class user extends \phpbb\session
*
* @param string $format Format of the entered date/time
* @param string $time Date/time with the timezone applied
- * @param DateTimeZone $timezone Timezone of the date/time, falls back to timezone of current user
+ * @param DateTimeZone|null $timezone Timezone of the date/time, falls back to timezone of current user
* @return int Returns the unix timestamp
*/
public function get_timestamp_from_format($format, $time, \DateTimeZone $timezone = null)
diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php
index 3cb8ea7cd6..0ca3384469 100644
--- a/tests/acp_board/select_auth_method_test.php
+++ b/tests/acp_board/select_auth_method_test.php
@@ -27,7 +27,7 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case
);
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/attachment/delete_test.php b/tests/attachment/delete_test.php
index 26f6d11bfc..e4eb5e56b9 100644
--- a/tests/attachment/delete_test.php
+++ b/tests/attachment/delete_test.php
@@ -38,7 +38,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -97,7 +97,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
*/
public function test_attachment_delete_success($remove_success, $exists_success, $expected, $throw_exception = false)
{
- $this->storage = $this->createMock('\phpbb\storage\storage', array('delete', 'exists'));
+ $this->storage = $this->createMock('\phpbb\storage\storage');
if ($throw_exception)
{
$this->storage->expects($this->any())
diff --git a/tests/attachment/manager_test.php b/tests/attachment/manager_test.php
index c440dcf101..8fcea043eb 100644
--- a/tests/attachment/manager_test.php
+++ b/tests/attachment/manager_test.php
@@ -17,7 +17,7 @@ class phpbb_attachment_manager_test extends \phpbb_test_case
protected $resync;
protected $upload;
- public function setUp(): void
+ protected function setUp(): void
{
$this->delete = $this->getMockBuilder('\phpbb\attachment\delete')
->disableOriginalConstructor()
diff --git a/tests/attachment/resync_test.php b/tests/attachment/resync_test.php
index de5ead5bff..f1ddaa00a5 100644
--- a/tests/attachment/resync_test.php
+++ b/tests/attachment/resync_test.php
@@ -24,7 +24,7 @@ class phpbb_attachment_resync_test extends \phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php
index eb7067b263..ae2c96ba84 100644
--- a/tests/attachment/upload_test.php
+++ b/tests/attachment/upload_test.php
@@ -45,9 +45,6 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
/** @var \phpbb\user */
protected $user;
- /** @var string phpBB root path */
- protected $phpbb_root_path;
-
/** @var \phpbb\db\driver\driver_interface */
protected $db;
@@ -69,12 +66,15 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
/** @var \bantu\IniGetWrapper\IniGetWrapper */
protected $php_ini;
+ /** @var \phpbb\request\request */
+ protected $request;
+
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $config, $phpbb_root_path, $phpEx;
@@ -115,15 +115,13 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
->method('get')
->willReturn(new \phpbb\files\filespec_storage(
$this->language,
- $this->php_ini,
new \FastImageSize\FastImageSize(),
$this->mimetype_guesser
));
- $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
+ $this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec_storage', new \phpbb\files\filespec_storage(
$this->language,
- $this->php_ini,
new \FastImageSize\FastImageSize(),
new \phpbb\mimetype\guesser(array(
'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(),
@@ -142,7 +140,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->request
));
$this->factory = new \phpbb\files\factory($this->container);
- $this->files_upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $this->files_upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$this->temp = new \phpbb\filesystem\temp($this->filesystem, '');
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
@@ -153,7 +151,6 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->config,
$this->files_upload,
$this->language,
- $this->mimetype_guesser,
$this->phpbb_dispatcher,
$this->plupload,
$this->storage,
@@ -246,7 +243,6 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->config,
$this->files_upload,
$this->language,
- $this->mimetype_guesser,
$this->phpbb_dispatcher,
$this->plupload,
$this->storage,
@@ -355,7 +351,6 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
))
->setConstructorArgs(array(
$this->language,
- $this->php_ini,
new \FastImageSize\FastImageSize(),
$this->mimetype_guesser,
$this->plupload
@@ -411,7 +406,6 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->config,
$this->files_upload,
$this->language,
- $this->mimetype_guesser,
$this->phpbb_dispatcher,
$plupload,
$this->storage,
diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php
index 0f9169ff8b..5b4c8ff9db 100644
--- a/tests/auth/provider_apache_test.php
+++ b/tests/auth/provider_apache_test.php
@@ -13,11 +13,16 @@
class phpbb_auth_provider_apache_test extends phpbb_database_test_case
{
+ /** @var \phpbb\auth\provider\apache */
protected $provider;
+
+ /** @var \phpbb\user */
protected $user;
+
+ /** @var \phpbb\request\request_interface */
protected $request;
- protected function setup(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php
index 8305e7caa4..472e6646a3 100644
--- a/tests/auth/provider_db_test.php
+++ b/tests/auth/provider_db_test.php
@@ -30,7 +30,6 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
));
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
- $request = $this->createMock('\phpbb\request\request');
$user = new \phpbb\user($lang, '\phpbb\datetime');
$driver_helper = new \phpbb\passwords\driver\helper($config);
$passwords_drivers = array(
@@ -58,7 +57,7 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
/** @var \phpbb\captcha\factory $captcha_factory */
$captcha_factory = $phpbb_container->get('captcha.factory');
- $provider = new \phpbb\auth\provider\db($captcha_factory, $config, $db, $passwords_manager, $request, $user, $phpbb_root_path, $phpEx);
+ $provider = new \phpbb\auth\provider\db($captcha_factory, $config, $db, $passwords_manager, $user);
$password_hash = '$2y$10$4RmpyVu2y8Yf/lP3.yQBquKvE54TCUuEDEBJYY6FDDFN3LcbCGz9i';
$expected = array(
diff --git a/tests/auth/provider_ldap_test.php b/tests/auth/provider_ldap_test.php
index 1ba47fd1f4..5ec1cb88d2 100644
--- a/tests/auth/provider_ldap_test.php
+++ b/tests/auth/provider_ldap_test.php
@@ -19,9 +19,10 @@ class phpbb_auth_provider_ldap_test extends phpbb_database_test_case
/** @var \phpbb\auth\provider\ldap */
protected $provider;
+ /** @var \phpbb\user */
protected $user;
- protected function setup() : void
+ protected function setUp() : void
{
parent::setUp();
diff --git a/tests/auth/provider_oauth_token_storage_test.php b/tests/auth/provider_oauth_token_storage_test.php
index 0c0e55dec6..737da70f7e 100644
--- a/tests/auth/provider_oauth_token_storage_test.php
+++ b/tests/auth/provider_oauth_token_storage_test.php
@@ -23,9 +23,11 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
protected $token_storage;
protected $token_storage_table;
protected $state_table;
+
+ /** @var \phpbb\user */
protected $user;
- protected function setup(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php
index 331792ae38..a94ba102f5 100644
--- a/tests/avatar/manager_test.php
+++ b/tests/avatar/manager_test.php
@@ -19,13 +19,16 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
protected $manager;
protected $avatar_foobar;
protected $avatar_barfoo;
+ protected $config;
+ protected $db;
+ protected $user;
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/users.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_root_path, $phpEx;
@@ -49,13 +52,6 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
$phpEx
);
- $guessers = array(
- new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(),
- new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(),
- new \phpbb\mimetype\extension_guesser,
- new \phpbb\mimetype\content_guesser,
- );
- $guesser = new \phpbb\mimetype\guesser($guessers);
$imagesize = new \FastImageSize\FastImageSize();
$dispatcher = new phpbb_mock_event_dispatcher();
diff --git a/tests/cache/apcu_driver_test.php b/tests/cache/apcu_driver_test.php
index 34bcf8f844..d3df5492a2 100644
--- a/tests/cache/apcu_driver_test.php
+++ b/tests/cache/apcu_driver_test.php
@@ -19,8 +19,6 @@ require_once dirname(__FILE__) . '/common_test_case.php';
class phpbb_cache_apcu_driver_test extends phpbb_cache_common_test_case
{
- protected static $config;
-
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
diff --git a/tests/cache/common_test_case.php b/tests/cache/common_test_case.php
index 64273c250a..023fa7e962 100644
--- a/tests/cache/common_test_case.php
+++ b/tests/cache/common_test_case.php
@@ -85,7 +85,7 @@ abstract class phpbb_cache_common_test_case extends phpbb_database_test_case
$this->assertEquals($expected, $first_result);
$sql = 'DELETE FROM phpbb_config';
- $result = $db->sql_query($sql);
+ $db->sql_query($sql);
$sql = "SELECT * FROM phpbb_config
WHERE config_name = 'foo'";
diff --git a/tests/cache/dummy_driver_test.php b/tests/cache/dummy_driver_test.php
index 6802e120ab..9827f34343 100644
--- a/tests/cache/dummy_driver_test.php
+++ b/tests/cache/dummy_driver_test.php
@@ -13,6 +13,8 @@
class phpbb_cache_dummy_driver_test extends phpbb_database_test_case
{
+ protected $driver;
+
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
@@ -60,7 +62,7 @@ class phpbb_cache_dummy_driver_test extends phpbb_database_test_case
$this->assertEquals($expected, $first_result);
$sql = 'DELETE FROM phpbb_config';
- $result = $db->sql_query($sql);
+ $db->sql_query($sql);
// As null cache driver does not actually cache,
// this should return no results
diff --git a/tests/captcha/qa_test.php b/tests/captcha/qa_test.php
index 0856bbd3c3..361b5482f1 100644
--- a/tests/captcha/qa_test.php
+++ b/tests/captcha/qa_test.php
@@ -23,7 +23,7 @@ class phpbb_captcha_qa_test extends \phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $db, $request, $phpbb_container;
diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php
index 60d8d26b13..b10010df3f 100644
--- a/tests/class_loader/class_loader_test.php
+++ b/tests/class_loader/class_loader_test.php
@@ -13,7 +13,7 @@
class phpbb_class_loader_test extends \phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_class_loader;
$phpbb_class_loader->unregister();
@@ -22,7 +22,7 @@ class phpbb_class_loader_test extends \phpbb_test_case
$phpbb_class_loader_ext->unregister();
}
- public function tearDown(): void
+ protected function tearDown(): void
{
global $phpbb_class_loader_ext;
$phpbb_class_loader_ext->register();
diff --git a/tests/config/db_test.php b/tests/config/db_test.php
index 46addc9d38..49d869e388 100644
--- a/tests/config/db_test.php
+++ b/tests/config/db_test.php
@@ -22,7 +22,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/config/db_text_test.php b/tests/config/db_text_test.php
index 0683abc1a9..6e443ddc43 100644
--- a/tests/config/db_text_test.php
+++ b/tests/config/db_text_test.php
@@ -16,12 +16,14 @@ class phpbb_config_db_text_test extends phpbb_database_test_case
/** @var \phpbb\config\db_text */
protected $config_text;
+ protected $db;
+
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config_text.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php
index 2bb4252c41..95525bd933 100644
--- a/tests/console/cache/purge_test.php
+++ b/tests/console/cache/purge_test.php
@@ -24,11 +24,10 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
protected $command_name;
protected $db;
protected $config;
+ protected $user;
protected function setUp(): void
{
- global $phpbb_root_path, $phpEx;
-
$this->cache_dir = dirname(__FILE__) . '/tmp/cache/';
if (file_exists($this->cache_dir))
@@ -44,10 +43,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
$this->db = $this->createMock('\phpbb\db\driver\driver_interface');
$this->config = new \phpbb\config\config(array('assets_version' => 1));
- $this->user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime')
- );
+ $this->user = $this->createMock('\phpbb\user');
}
public function test_purge()
diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php
index 65bfad4757..b828be2ec4 100644
--- a/tests/console/config/config_test.php
+++ b/tests/console/config/config_test.php
@@ -20,16 +20,13 @@ class phpbb_console_command_config_test extends phpbb_test_case
protected $command_name;
protected $user;
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_root_path, $phpEx;
$this->config = new \phpbb\config\config(array());
- $this->user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime')
- );
+ $this->user = $this->createMock('\phpbb\user');
$this->user->method('lang')->will($this->returnArgument(0));
}
diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php
index 69ae53c128..fb6fe3c502 100644
--- a/tests/console/cron/cron_list_test.php
+++ b/tests/console/cron/cron_list_test.php
@@ -34,10 +34,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
- $this->user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $this->user = $this->createMock('\phpbb\user');
$this->user->method('lang')->will($this->returnArgument(0));
}
diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php
index 16b2548d09..013e841442 100644
--- a/tests/console/cron/run_test.php
+++ b/tests/console/cron/run_test.php
@@ -32,7 +32,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $db, $config, $phpbb_root_path, $phpEx;
@@ -40,10 +40,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$config = $this->config = new \phpbb\config\config(array('cron_lock' => '0'));
$this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db);
- $this->user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $this->user = $this->createMock('\phpbb\user');
$this->user->method('lang')->will($this->returnArgument(0));
$this->task = new phpbb_cron_task_simple();
diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php
index 8f4da5a414..cbe743bdef 100644
--- a/tests/console/thumbnail_test.php
+++ b/tests/console/thumbnail_test.php
@@ -32,7 +32,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/thumbnail.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $config, $phpbb_root_path, $phpEx, $phpbb_filesystem;
@@ -50,14 +50,11 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
));
$this->db = $this->db = $this->new_dbal();
- $this->user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime')
- );
+ $this->user = $this->createMock('\phpbb\user');
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
- $this->cache = $this->createMock('\phpbb\cache\service', array(), array(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx));
+ $this->cache = $this->createMock('\phpbb\cache\service');
$this->cache->expects(self::any())->method('obtain_attach_extensions')->will(self::returnValue(array(
'png' => array('display_cat' => ATTACHMENT_CATEGORY_IMAGE),
'txt' => array('display_cat' => ATTACHMENT_CATEGORY_NONE),
diff --git a/tests/console/update/check_test.php b/tests/console/update/check_test.php
index 6812ea61b8..555c9454e1 100644
--- a/tests/console/update/check_test.php
+++ b/tests/console/update/check_test.php
@@ -84,10 +84,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
- $user = $this->createMock('\phpbb\user', array(), array(
- $this->language,
- '\phpbb\datetime'
- ));
+ $user = $this->createMock('\phpbb\user');
$user->method('lang')->will($this->returnArgument(0));
$cache = $this->getMockBuilder('\phpbb\cache\service')
diff --git a/tests/console/user/activate_test.php b/tests/console/user/activate_test.php
index 51e9754b59..261eac152a 100644
--- a/tests/console/user/activate_test.php
+++ b/tests/console/user/activate_test.php
@@ -21,7 +21,7 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
{
protected $notifications;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -35,7 +35,6 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
$application = new Application();
$application->add(new activate(
$this->user,
- $this->db,
$this->config,
$this->language,
$this->log,
diff --git a/tests/console/user/base.php b/tests/console/user/base.php
index 74f04cf686..c40a0070ac 100644
--- a/tests/console/user/base.php
+++ b/tests/console/user/base.php
@@ -31,7 +31,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $auth, $db, $cache, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx;
@@ -62,10 +62,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$this->language->expects($this->any())
->method('lang')
->will($this->returnArgument(0));
- $user = $this->user = $this->createMock('\phpbb\user', array(), array(
- $this->language,
- '\phpbb\datetime'
- ));
+ $user = $this->user = $this->createMock('\phpbb\user');
$this->user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
diff --git a/tests/console/user/delete_test.php b/tests/console/user/delete_test.php
index 926e496e1e..4535c4e295 100644
--- a/tests/console/user/delete_test.php
+++ b/tests/console/user/delete_test.php
@@ -24,7 +24,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
$application = new Application();
$application->add(new delete(
$this->user,
- $this->db,
$this->language,
$this->log,
$this->user_loader,
diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php
index 6026778487..922897b0b3 100644
--- a/tests/content_visibility/get_visibility_sql_test.php
+++ b/tests/content_visibility/get_visibility_sql_test.php
@@ -146,7 +146,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime');
$user->data['user_id'] = $user_id;
- $config = $this->config = new \phpbb\config\config(array(
+ $config = new \phpbb\config\config(array(
'display_unapproved_posts' => $display_unapproved,
));
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php
index 67a0ce48c2..6b128269a3 100644
--- a/tests/controller/common_helper_route.php
+++ b/tests/controller/common_helper_route.php
@@ -41,7 +41,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
@@ -125,7 +125,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
$cache_path,
null,
$loader,
- new \phpbb\event\dispatcher($container),
+ new \phpbb\event\dispatcher(),
array(
'cache' => false,
'debug' => false,
@@ -151,7 +151,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
);
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager);
- $this->router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
+ $this->router = new phpbb_mock_router($container, $resources_locator, $loader, 'php', dirname(__FILE__) . '/');
$this->auth = new \phpbb\auth\auth();
$this->cache = new \phpbb\cache\driver\dummy();
$this->db = $this->new_dbal();
diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php
index 89631552af..0f5bc34cd4 100644
--- a/tests/controller/controller_test.php
+++ b/tests/controller/controller_test.php
@@ -21,7 +21,7 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
class phpbb_controller_controller_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
$this->extension_manager = new phpbb_mock_extension_manager(
dirname(__FILE__) . '/',
@@ -48,7 +48,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
);
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager);
- $router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
+ $router = new phpbb_mock_router($container, $resources_locator, $loader, 'php', dirname(__FILE__) . '/');
$routes = $router->get_routes();
// This will need to be updated if any new routes are defined
diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php
index 3cfc17fdeb..e5326daa2c 100644
--- a/tests/cron/manager_test.php
+++ b/tests/cron/manager_test.php
@@ -20,7 +20,10 @@ require_once dirname(__FILE__) . '/tasks/simple_should_not_run.php';
class phpbb_cron_manager_test extends \phpbb_test_case
{
- public function setUp(): void
+ protected $manager;
+ protected $tast_name;
+
+ protected function setUp(): void
{
$this->manager = $this->create_cron_manager(array(
new phpbb_cron_task_core_dummy_task(),
diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php
index 27d10d2843..d274794728 100644
--- a/tests/dbal/auto_increment_test.php
+++ b/tests/dbal/auto_increment_test.php
@@ -62,7 +62,7 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case
public function test_auto_increment()
{
$sql = 'DELETE FROM prefix_table_name';
- $result = $this->db->sql_query($sql);
+ $this->db->sql_query($sql);
$row1 = array_merge(self::get_default_values(), array(
'c_uint' => 1,
@@ -72,11 +72,11 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case
));
$sql = 'INSERT INTO prefix_table_name ' . $this->db->sql_build_array('INSERT', $row1);
- $result = $this->db->sql_query($sql);
+ $this->db->sql_query($sql);
$id1 = $this->db->sql_nextid();
$sql = 'INSERT INTO prefix_table_name ' . $this->db->sql_build_array('INSERT', $row2);
- $result = $this->db->sql_query($sql);
+ $this->db->sql_query($sql);
$id2 = $this->db->sql_nextid();
$this->assertGreaterThan($id1, $id2, 'Auto increment should increase the id value');
diff --git a/tests/dbal/connect_test.php b/tests/dbal/connect_test.php
index 3933dab798..ef7762b5d6 100644
--- a/tests/dbal/connect_test.php
+++ b/tests/dbal/connect_test.php
@@ -20,7 +20,7 @@ class phpbb_dbal_connect_test extends phpbb_database_test_case
public function test_failing_connect()
{
- global $phpbb_root_path, $phpEx, $phpbb_filesystem;
+ global $phpbb_filesystem;
$phpbb_filesystem = new phpbb\filesystem\filesystem();
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index 20ea2b3729..ba5f40003d 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -182,10 +182,10 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
// empty table
$sql = 'DELETE FROM prefix_table_name';
- $result = $this->db->sql_query($sql);
+ $this->db->sql_query($sql);
$sql = 'INSERT INTO prefix_table_name ' . $this->db->sql_build_array('INSERT', $row_insert);
- $result = $this->db->sql_query($sql);
+ $this->db->sql_query($sql);
$sql = "SELECT *
FROM prefix_table_name";
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index 947da726b3..acb4fa00c2 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -44,7 +44,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php
index 74d816dbcd..01f5d9e54f 100644
--- a/tests/dbal/migrator_tool_config_test.php
+++ b/tests/dbal/migrator_tool_config_test.php
@@ -13,7 +13,7 @@
class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
$this->config = new \phpbb\config\config(array());
diff --git a/tests/dbal/migrator_tool_config_text_test.php b/tests/dbal/migrator_tool_config_text_test.php
index 051e0a7556..11d6d529b4 100644
--- a/tests/dbal/migrator_tool_config_text_test.php
+++ b/tests/dbal/migrator_tool_config_text_test.php
@@ -18,9 +18,9 @@ class phpbb_dbal_migrator_tool_config_text_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator_config_text.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
- parent::setup();
+ parent::setUp();
$this->db = $this->new_dbal();
$this->config_text = new \phpbb\config\db_text($this->db, 'phpbb_config_text');
diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php
index ecc7b384e7..57f343e531 100644
--- a/tests/dbal/migrator_tool_module_test.php
+++ b/tests/dbal/migrator_tool_module_test.php
@@ -21,12 +21,12 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator_module.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
// Need global $db, $user for delete_module function in acp_modules
global $phpbb_root_path, $phpEx, $skip_add_log, $db, $user, $phpbb_log;
- parent::setup();
+ parent::setUp();
// Disable the logs
$skip_add_log = true;
@@ -48,7 +48,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
$phpbb_extension_manager = new phpbb_mock_extension_manager($phpbb_root_path);
$module_manager = new \phpbb\module\module_manager($cache, $this->db, $phpbb_extension_manager, MODULES_TABLE, $phpbb_root_path, $phpEx);
- $this->tool = new \phpbb\db\migration\tool\module($this->db, $this->cache, $this->user, $module_manager, $phpbb_root_path, $phpEx, 'phpbb_modules');
+ $this->tool = new \phpbb\db\migration\tool\module($this->db, $this->user, $module_manager, 'phpbb_modules');
}
public function exists_data_acp()
diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php
index e9cf55a0ce..09bea5a116 100644
--- a/tests/dbal/migrator_tool_permission_test.php
+++ b/tests/dbal/migrator_tool_permission_test.php
@@ -30,12 +30,12 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator_permission.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
// Global $db and $cache are needed in acp/auth.php constructor
global $phpbb_root_path, $phpEx, $db, $cache;
- parent::setup();
+ parent::setUp();
$db = $this->db = $this->new_dbal();
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
diff --git a/tests/dbal/schema_test.php b/tests/dbal/schema_test.php
index 59965655ad..2edb8d8b01 100644
--- a/tests/dbal/schema_test.php
+++ b/tests/dbal/schema_test.php
@@ -26,7 +26,7 @@ class phpbb_dbal_schema_test extends phpbb_database_test_case
$sql = "INSERT INTO phpbb_config
(config_name, config_value)
VALUES ('name', '$value')";
- $result = $db->sql_query($sql);
+ $db->sql_query($sql);
$sql = "SELECT config_value
FROM phpbb_config
diff --git a/tests/dbal/sql_affected_rows_test.php b/tests/dbal/sql_affected_rows_test.php
index e9fb1f2724..e6d0b79c40 100644
--- a/tests/dbal/sql_affected_rows_test.php
+++ b/tests/dbal/sql_affected_rows_test.php
@@ -16,7 +16,7 @@ class phpbb_dbal_sql_affected_rows_test extends phpbb_database_test_case
/** @var \phpbb\db\driver\driver_interface */
protected $db;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->db = $this->new_dbal();
diff --git a/tests/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php
index b0e678b9da..f06d013924 100644
--- a/tests/dbal/sql_insert_buffer_test.php
+++ b/tests/dbal/sql_insert_buffer_test.php
@@ -16,7 +16,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
protected $db;
protected $buffer;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php
index 16b49d1f17..bb87a57a7b 100644
--- a/tests/di/create_container_test.php
+++ b/tests/di/create_container_test.php
@@ -26,7 +26,7 @@ namespace
protected $phpbb_root_path;
protected $filename;
- public function setUp(): void
+ protected function setUp(): void
{
$this->phpbb_root_path = dirname(__FILE__) . '/';
$this->config_php = new \phpbb\config_php_file($this->phpbb_root_path . 'fixtures/', 'php');
diff --git a/tests/di/ordered_service_collection_test.php b/tests/di/ordered_service_collection_test.php
index baa9776573..e1d768d814 100644
--- a/tests/di/ordered_service_collection_test.php
+++ b/tests/di/ordered_service_collection_test.php
@@ -18,7 +18,7 @@ class phpbb_ordered_service_collection_test extends \phpbb_test_case
*/
protected $service_collection;
- public function setUp(): void
+ protected function setUp(): void
{
$container = new phpbb_mock_container_builder();
$container->set('foo', new StdClass);
diff --git a/tests/di/service_collection_test.php b/tests/di/service_collection_test.php
index 97c13ab163..fd0e13e48b 100644
--- a/tests/di/service_collection_test.php
+++ b/tests/di/service_collection_test.php
@@ -18,7 +18,7 @@ class phpbb_service_collection_test extends \phpbb_test_case
*/
protected $service_collection;
- public function setUp(): void
+ protected function setUp(): void
{
$container = new phpbb_mock_container_builder();
$container->set('foo', new StdClass);
diff --git a/tests/email/email_parsing_test.php b/tests/email/email_parsing_test.php
index a7f76d50a2..be61d82bde 100644
--- a/tests/email/email_parsing_test.php
+++ b/tests/email/email_parsing_test.php
@@ -19,7 +19,7 @@ class phpbb_email_parsing_test extends phpbb_test_case
/** @var \ReflectionProperty */
protected $reflection_template_property;
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_container, $config, $phpbb_root_path, $phpEx, $request, $user;
@@ -73,7 +73,7 @@ class phpbb_email_parsing_test extends phpbb_test_case
$cache_path,
null,
new \phpbb\template\twig\loader(''),
- new \phpbb\event\dispatcher($phpbb_container),
+ new \phpbb\event\dispatcher(),
array(
'cache' => false,
'debug' => false,
diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php
index c7701cfad0..7b73679fda 100644
--- a/tests/error_collector_test.php
+++ b/tests/error_collector_test.php
@@ -13,7 +13,7 @@
class phpbb_error_collector_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/event/dispatcher_test.php b/tests/event/dispatcher_test.php
index da28d24daa..deebfc657c 100644
--- a/tests/event/dispatcher_test.php
+++ b/tests/event/dispatcher_test.php
@@ -15,7 +15,7 @@ class phpbb_event_dispatcher_test extends phpbb_test_case
{
public function test_trigger_event()
{
- $dispatcher = new \phpbb\event\dispatcher(new phpbb_mock_container_builder());
+ $dispatcher = new \phpbb\event\dispatcher();
$dispatcher->addListener('core.test_event', function (\phpbb\event\data $event) {
$event['foo'] = $event['foo'] . '2';
diff --git a/tests/event/export_php_test.php b/tests/event/export_php_test.php
index 92280b6f4f..4412b6d0bd 100644
--- a/tests/event/export_php_test.php
+++ b/tests/event/export_php_test.php
@@ -16,7 +16,7 @@ class phpbb_event_export_php_test extends phpbb_test_case
/** @var \phpbb\event\php_exporter */
protected $exporter;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -28,7 +28,7 @@ class phpbb_event_export_php_test extends phpbb_test_case
{
global $phpbb_root_path;
$exporter = new \phpbb\event\php_exporter($phpbb_root_path);
- $files = $exporter->get_recursive_file_list($phpbb_root_path);
+ $files = $exporter->get_recursive_file_list();
$data_provider = array();
foreach ($files as $file)
diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php
index 2eeb48ea05..c4ea3fbecc 100644
--- a/tests/event/md_exporter_test.php
+++ b/tests/event/md_exporter_test.php
@@ -126,7 +126,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case
);
foreach ($styles as $path => $filter)
{
- $files = $exporter->get_recursive_file_list($phpbb_root_path . $path, $path);
+ $files = $exporter->get_recursive_file_list($phpbb_root_path . $path);
foreach ($files as $file)
{
$data_provider[] = array($filter, $path . $file);
diff --git a/tests/event/php_exporter_test.php b/tests/event/php_exporter_test.php
index 5c9e20aa7d..2cc2b0c7a0 100644
--- a/tests/event/php_exporter_test.php
+++ b/tests/event/php_exporter_test.php
@@ -16,7 +16,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case
/** @var \phpbb\event\php_exporter */
protected $exporter;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->exporter = new \phpbb\event\php_exporter(dirname(__FILE__) . '/fixtures/');
diff --git a/tests/extension/extension_base_test.php b/tests/extension/extension_base_test.php
index 1f44fdb234..ab85d3f02e 100644
--- a/tests/extension/extension_base_test.php
+++ b/tests/extension/extension_base_test.php
@@ -30,7 +30,7 @@ class phpbb_extension_extension_base_test extends phpbb_test_case
self::$reflection_method_get_migration_file_list->setAccessible(true);
}
- public function setUp(): void
+ protected function setUp(): void
{
$container = new phpbb_mock_container_builder();
$migrator = new phpbb_mock_migrator();
diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php
index c86b81f147..5ee43e8a29 100644
--- a/tests/extension/finder_test.php
+++ b/tests/extension/finder_test.php
@@ -18,7 +18,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
/** @var \phpbb\finder */
protected $finder;
- public function setUp(): void
+ protected function setUp(): void
{
$this->extension_manager = new phpbb_mock_extension_manager(
dirname(__FILE__) . '/',
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index 2e1a85a013..b37f6742a2 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -69,7 +69,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$cache_path,
null,
$loader,
- new \phpbb\event\dispatcher($container),
+ new \phpbb\event\dispatcher(),
array(
'cache' => false,
'debug' => false,
diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php
index f8c65bc147..0d4202dcb3 100644
--- a/tests/extension/modules_test.php
+++ b/tests/extension/modules_test.php
@@ -24,7 +24,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
protected $finder;
protected $module_manager;
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_extension_manager;
diff --git a/tests/feed/attachments_base_test.php b/tests/feed/attachments_base_test.php
index df91d8cc5d..cf1deb8eb2 100644
--- a/tests/feed/attachments_base_test.php
+++ b/tests/feed/attachments_base_test.php
@@ -15,8 +15,6 @@ require_once(dirname(__FILE__) . '/attachments_mock_feed.php');
class phpbb_feed_attachments_base_test extends phpbb_database_test_case
{
- protected $filesystem;
-
/** @var \phpbb_feed_attachments_mock_feed */
protected $attachments_mocks_feed;
@@ -25,11 +23,10 @@ class phpbb_feed_attachments_base_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/../extension/fixtures/extensions.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_root_path, $phpEx;
- $this->filesystem = new \phpbb\filesystem();
$config = new \phpbb\config\config(array());
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php
index 28c5a12c3d..877c4c98e2 100644
--- a/tests/files/types_base_test.php
+++ b/tests/files/types_base_test.php
@@ -13,8 +13,7 @@
class phpbb_files_types_base_test extends phpbb_test_case
{
- private $path;
-
+ /** @var \phpbb\filesystem\filesystem */
private $filesystem;
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
@@ -32,9 +31,6 @@ class phpbb_files_types_base_test extends phpbb_test_case
/** @var \phpbb\request\request_interface */
protected $request;
- /** @var string phpBB root path */
- protected $phpbb_root_path;
-
protected function setUp(): void
{
global $phpbb_root_path, $phpEx;
@@ -45,7 +41,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
- $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
+ $this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -56,9 +52,6 @@ class phpbb_files_types_base_test extends phpbb_test_case
'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(),
))));
$this->factory = new \phpbb\files\factory($this->container);
-
- $this->path = __DIR__ . '/fixture/';
- $this->phpbb_root_path = $phpbb_root_path;
}
public function data_check_upload_size()
@@ -79,7 +72,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);
+ $upload = new \phpbb\files\upload($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()
diff --git a/tests/files/types_form_test.php b/tests/files/types_form_test.php
index ffebcf603f..dd9ad7280c 100644
--- a/tests/files/types_form_test.php
+++ b/tests/files/types_form_test.php
@@ -13,8 +13,7 @@
class phpbb_files_types_form_test extends phpbb_test_case
{
- private $path;
-
+ /** @var \phpbb\filesystem\filesystem */
private $filesystem;
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
@@ -51,7 +50,7 @@ class phpbb_files_types_form_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
- $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
+ $this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -69,7 +68,6 @@ class phpbb_files_types_form_test extends phpbb_test_case
->method('handle_upload')
->willReturn(array());
- $this->path = __DIR__ . '/fixture/';
$this->phpbb_root_path = $phpbb_root_path;
}
@@ -160,7 +158,7 @@ class phpbb_files_types_form_test extends phpbb_test_case
->willReturn($plupload);
$type_form = new \phpbb\files\types\form($this->factory, $this->language, $this->php_ini, $this->plupload, $this->request);
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_form->set_upload($upload);
diff --git a/tests/files/types_local_test.php b/tests/files/types_local_test.php
index 7468e9c4a7..106f8cda2f 100644
--- a/tests/files/types_local_test.php
+++ b/tests/files/types_local_test.php
@@ -13,8 +13,7 @@
class phpbb_files_types_local_test extends phpbb_test_case
{
- private $path;
-
+ /** @var \phpbb\filesystem\filesystem */
private $filesystem;
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
@@ -51,7 +50,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
- $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
+ $this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -69,7 +68,6 @@ class phpbb_files_types_local_test extends phpbb_test_case
->method('handle_upload')
->willReturn(array());
- $this->path = __DIR__ . '/fixture/';
$this->phpbb_root_path = $phpbb_root_path;
}
@@ -149,7 +147,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
$this->factory = new \phpbb\files\factory($this->container);
$type_local = new \phpbb\files\types\local($this->factory, $this->language, $this->php_ini, $this->request);
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_local->set_upload($upload);
diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php
index 3b3d61acac..e404c928b9 100644
--- a/tests/files/types_remote_test.php
+++ b/tests/files/types_remote_test.php
@@ -15,9 +15,6 @@ require_once dirname(__FILE__) . '/type_foo.php';
class phpbb_files_types_remote_test extends phpbb_test_case
{
- /** @var string */
- private $path;
-
/** @var \phpbb\filesystem\filesystem */
private $filesystem;
@@ -60,7 +57,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
- $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
+ $this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -72,14 +69,13 @@ class phpbb_files_types_remote_test extends phpbb_test_case
))));
$this->factory = new \phpbb\files\factory($this->container);
- $this->path = __DIR__ . '/fixture/';
$this->phpbb_root_path = $phpbb_root_path;
}
public function test_upload_fsock_fail()
{
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $this->php_ini, $this->request);
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);
@@ -114,7 +110,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
->method('getString')
->willReturn($max_file_size);
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $php_ini, $this->request);
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);
@@ -126,7 +122,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
public function test_upload_wrong_path()
{
$type_remote = new \phpbb\files\types\foo($this->config, $this->factory, $this->temp, $this->language, $this->php_ini, $this->request);
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);
$type_remote::$tempnam_path = $this->phpbb_root_path . 'cache/wrong/path';
diff --git a/tests/files/upload_test.php b/tests/files/upload_test.php
index c8857f863d..1fda63e453 100644
--- a/tests/files/upload_test.php
+++ b/tests/files/upload_test.php
@@ -13,8 +13,7 @@
class phpbb_files_upload_test extends phpbb_test_case
{
- private $path;
-
+ /** @var \phpbb\filesystem\filesystem */
private $filesystem;
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
@@ -32,9 +31,6 @@ class phpbb_files_upload_test extends phpbb_test_case
/** @var \phpbb\request\request_interface */
protected $request;
- /** @var string phpBB root path */
- protected $phpbb_root_path;
-
protected function setUp(): void
{
// Global $config required by unique_id
@@ -54,7 +50,7 @@ class phpbb_files_upload_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
- $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
+ $this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -65,14 +61,11 @@ class phpbb_files_upload_test extends phpbb_test_case
'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(),
))));
$this->factory = new \phpbb\files\factory($this->container);
-
- $this->path = __DIR__ . '/fixture/';
- $this->phpbb_root_path = $phpbb_root_path;
}
public function test_reset_vars()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_max_filesize(500);
$this->assertEquals(500, $upload->max_filesize);
$upload->reset_vars();
@@ -81,7 +74,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_set_disallowed_content()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$disallowed_content = new ReflectionProperty($upload, 'disallowed_content');
$disallowed_content->setAccessible(true);
@@ -89,7 +82,7 @@ class phpbb_files_upload_test extends phpbb_test_case
$this->assertEquals(array('foo'), $disallowed_content->getValue($upload));
$upload->set_disallowed_content(array('foo', 'bar', 'meh'));
$this->assertEquals(array('foo', 'bar', 'meh'), $disallowed_content->getValue($upload));
- $upload->set_disallowed_content('');
+ $upload->set_disallowed_content(false);
$this->assertEquals(array('foo', 'bar', 'meh'), $disallowed_content->getValue($upload));
$this->assertINstanceOf('\phpbb\files\upload', $upload->set_disallowed_content(array()));
$this->assertEquals(array(), $disallowed_content->getValue($upload));
@@ -99,7 +92,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_is_valid()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$this->assertFalse($upload->is_valid('foobar'));
}
@@ -122,7 +115,7 @@ class phpbb_files_upload_test extends phpbb_test_case
*/
public function test_assign_internal_error($error_code, $expected)
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$this->assertSame($expected, $upload->assign_internal_error($error_code));
}
}
diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php
index dbb06e5e74..f64d306d90 100644
--- a/tests/filesystem/clean_path_test.php
+++ b/tests/filesystem/clean_path_test.php
@@ -15,7 +15,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case
{
protected $filesystem;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->filesystem = new \phpbb\filesystem\filesystem();
diff --git a/tests/filesystem/helper_clean_path_test.php b/tests/filesystem/helper_clean_path_test.php
index d1b5a18f02..c0c8783321 100644
--- a/tests/filesystem/helper_clean_path_test.php
+++ b/tests/filesystem/helper_clean_path_test.php
@@ -16,7 +16,7 @@ use phpbb\filesystem\helper as filesystem_helper;
class phpbb_filesystem_helper_clean_path_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
}
diff --git a/tests/filesystem/helper_is_absolute_test.php b/tests/filesystem/helper_is_absolute_test.php
index 16356386d1..954cf6a30b 100644
--- a/tests/filesystem/helper_is_absolute_test.php
+++ b/tests/filesystem/helper_is_absolute_test.php
@@ -16,7 +16,7 @@ use phpbb\filesystem\helper as filesystem_helper;
class phpbb_filesystem_helper_is_absolute_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
}
diff --git a/tests/filesystem/helper_realpath_test.php b/tests/filesystem/helper_realpath_test.php
index bfb871384b..f3c7742cd5 100644
--- a/tests/filesystem/helper_realpath_test.php
+++ b/tests/filesystem/helper_realpath_test.php
@@ -25,7 +25,7 @@ class phpbb_filesystem_helper_realpath_test extends phpbb_test_case
self::$filesystem_helper_phpbb_own_realpath->setAccessible(true);
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
}
diff --git a/tests/filesystem/is_absolute_test.php b/tests/filesystem/is_absolute_test.php
index 55e729feb7..165130ae85 100644
--- a/tests/filesystem/is_absolute_test.php
+++ b/tests/filesystem/is_absolute_test.php
@@ -16,7 +16,7 @@ class phpbb_filesystem_is_absolute_test extends phpbb_test_case
/** @var \phpbb\filesystem\filesystem_interface */
protected $filesystem;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/filesystem/realpath_test.php b/tests/filesystem/realpath_test.php
index 3d05cd7ff2..58291dac93 100644
--- a/tests/filesystem/realpath_test.php
+++ b/tests/filesystem/realpath_test.php
@@ -27,7 +27,7 @@ class phpbb_filesystem_realpath_test extends phpbb_test_case
self::$filesystem_own_realpath->setAccessible(true);
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functional/acp_permissions_test.php b/tests/functional/acp_permissions_test.php
index ccaa4aab29..41fa03639e 100644
--- a/tests/functional/acp_permissions_test.php
+++ b/tests/functional/acp_permissions_test.php
@@ -16,7 +16,7 @@
*/
class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functional/acp_profile_field_test.php b/tests/functional/acp_profile_field_test.php
index 4c0414f03a..44755675b4 100644
--- a/tests/functional/acp_profile_field_test.php
+++ b/tests/functional/acp_profile_field_test.php
@@ -16,7 +16,7 @@
*/
class phpbb_functional_acp_profile_field_test extends phpbb_functional_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functional/acp_users_test.php b/tests/functional/acp_users_test.php
index c8d0072c28..5c10f809d6 100644
--- a/tests/functional/acp_users_test.php
+++ b/tests/functional/acp_users_test.php
@@ -16,7 +16,7 @@
*/
class phpbb_functional_acp_users_test extends phpbb_functional_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functional/common_avatar_test_case.php b/tests/functional/common_avatar_test_case.php
index 155f6e0c09..36987a0c45 100644
--- a/tests/functional/common_avatar_test_case.php
+++ b/tests/functional/common_avatar_test_case.php
@@ -17,11 +17,10 @@
abstract class phpbb_functional_common_avatar_test_case extends phpbb_functional_test_case
{
private $path;
- private $form_content;
abstract function get_url();
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->path = __DIR__ . '/fixtures/files/';
diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php
index 33a9b443bb..1e6cd955d8 100644
--- a/tests/functional/extension_acp_test.php
+++ b/tests/functional/extension_acp_test.php
@@ -37,7 +37,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
self::$helper->restore_original_ext_dir();
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index c5ebf761c9..92a9d2af6d 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -45,7 +45,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
self::$helper->restore_original_ext_dir();
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php
index 94c80a6d9a..248f05e220 100644
--- a/tests/functional/extension_global_lang_test.php
+++ b/tests/functional/extension_global_lang_test.php
@@ -41,7 +41,7 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_
self::$helper->restore_original_ext_dir();
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -52,7 +52,7 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_
$this->purge_cache();
}
- public function tearDown(): void
+ protected function tearDown(): void
{
parent::tearDown();
diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php
index 09d0124990..fa7bc63a69 100644
--- a/tests/functional/extension_module_test.php
+++ b/tests/functional/extension_module_test.php
@@ -40,7 +40,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
self::$helper->restore_original_ext_dir();
}
- public function setUp(): void
+ protected function setUp(): void
{
global $db;
diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php
index e0721ad1ec..52bed0a64b 100644
--- a/tests/functional/extension_permission_lang_test.php
+++ b/tests/functional/extension_permission_lang_test.php
@@ -41,7 +41,7 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t
self::$helper->restore_original_ext_dir();
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php
index b26a228523..bf871ec02a 100644
--- a/tests/functional/feed_test.php
+++ b/tests/functional/feed_test.php
@@ -20,7 +20,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
static public $init_values = array();
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->purge_cache();
diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php
index b2f230b66f..a08ec4ee43 100644
--- a/tests/functional/fileupload_form_test.php
+++ b/tests/functional/fileupload_form_test.php
@@ -18,14 +18,14 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
{
private $path;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->path = __DIR__ . '/fixtures/files/';
$this->add_lang('posting');
}
- public function tearDown(): void
+ protected function tearDown(): void
{
$iterator = new DirectoryIterator(__DIR__ . '/../../phpBB/files/');
foreach ($iterator as $fileinfo)
diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php
index f327981960..9cb6434922 100644
--- a/tests/functional/fileupload_remote_test.php
+++ b/tests/functional/fileupload_remote_test.php
@@ -37,7 +37,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
/** @var string phpBB root path */
protected $phpbb_root_path;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
// Only doing this within the functional framework because we need a
@@ -69,7 +69,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
$this->phpbb_root_path = $phpbb_root_path;
}
- public function tearDown(): void
+ protected function tearDown(): void
{
global $config, $user;
$user = null;
@@ -79,7 +79,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_invalid_extension()
{
/** @var \phpbb\files\upload $upload */
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_error_prefix('')
->set_allowed_extensions(array('jpg'))
->set_max_filesize(100);
@@ -90,7 +90,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_empty_file()
{
/** @var \phpbb\files\upload $upload */
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_error_prefix('')
->set_allowed_extensions(array('jpg'))
->set_max_filesize(100);
@@ -101,7 +101,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_successful_upload()
{
/** @var \phpbb\files\upload $upload */
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_error_prefix('')
->set_allowed_extensions(array('gif'))
->set_max_filesize(2000);
@@ -114,7 +114,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_too_large()
{
/** @var \phpbb\files\upload $upload */
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_error_prefix('')
->set_allowed_extensions(array('gif'))
->set_max_filesize(100);
diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php
index 10946fe5a9..b5309aa5be 100644
--- a/tests/functional/forgot_password_test.php
+++ b/tests/functional/forgot_password_test.php
@@ -18,7 +18,6 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case
{
public function test_forgot_password_enabled()
{
- global $config;
$this->add_lang('ucp');
$crawler = self::request('GET', 'app.php/user/forgot_password');
$this->assertEquals($this->lang('RESET_PASSWORD'), $crawler->filter('h2')->text());
@@ -45,7 +44,7 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case
}
- public function tearDown(): void
+ protected function tearDown(): void
{
$this->login();
$this->admin_login();
diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php
index 4f4fad4434..3ffed7f66d 100644
--- a/tests/functional/metadata_manager_test.php
+++ b/tests/functional/metadata_manager_test.php
@@ -24,7 +24,7 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
'foo/bar/',
);
- public function tearDown(): void
+ protected function tearDown(): void
{
$this->purge_cache();
@@ -46,7 +46,7 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
self::$helper->restore_original_ext_dir();
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php
index b7b5b08360..990983985e 100644
--- a/tests/functional/plupload_test.php
+++ b/tests/functional/plupload_test.php
@@ -30,7 +30,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case
$db->sql_query($query);
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->purge_cache();
@@ -40,7 +40,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case
$this->login();
}
- public function tearDown(): void
+ protected function tearDown(): void
{
$this->set_extension_group_permission(0);
$iterator = new DirectoryIterator(__DIR__ . '/../../phpBB/files/');
diff --git a/tests/functional/prune_shadow_topic_test.php b/tests/functional/prune_shadow_topic_test.php
index 1d4bb02a95..9bf54fcb19 100644
--- a/tests/functional/prune_shadow_topic_test.php
+++ b/tests/functional/prune_shadow_topic_test.php
@@ -126,7 +126,7 @@ class phpbb_functional_prune_shadow_topic_test extends phpbb_functional_test_cas
$sql = 'UPDATE phpbb_topics
SET topic_last_post_time = ' . (time() - 60*60*24*3) . '
WHERE topic_id = ' . ($this->data['topics']['Prune Shadow #1'] + 1);
- $result = $this->db->sql_query($sql);
+ $this->db->sql_query($sql);
$crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Prune Shadow']}&sid={$this->sid}");
$this->assertNotEmpty($crawler->filter('img')->last()->attr('src'));
diff --git a/tests/functional/search/base.php b/tests/functional/search/base.php
index 48c444fb76..9e49ba93ab 100644
--- a/tests/functional/search/base.php
+++ b/tests/functional/search/base.php
@@ -16,6 +16,8 @@
*/
abstract class phpbb_functional_search_base extends phpbb_functional_test_case
{
+ protected $search_backend;
+
protected function assert_search_found($keywords, $posts_found, $words_highlighted)
{
$crawler = self::request('GET', 'search.php?keywords=' . $keywords);
diff --git a/tests/functional/ucp_pm_test.php b/tests/functional/ucp_pm_test.php
index 53de247202..283df83292 100644
--- a/tests/functional/ucp_pm_test.php
+++ b/tests/functional/ucp_pm_test.php
@@ -16,7 +16,7 @@
*/
class phpbb_functional_ucp_pm_test extends phpbb_functional_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->login();
diff --git a/tests/functional/user_password_reset_test.php b/tests/functional/user_password_reset_test.php
index a97300b9ee..2c8be363e7 100644
--- a/tests/functional/user_password_reset_test.php
+++ b/tests/functional/user_password_reset_test.php
@@ -152,7 +152,7 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca
$cookies = self::$cookieJar->all();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
- foreach ($cookies as $cookie);
+ foreach ($cookies as $cookie)
{
if (substr($cookie->getName(), -4) == '_sid')
{
diff --git a/tests/functional/visibility_unapproved_posts_test.php b/tests/functional/visibility_unapproved_posts_test.php
index 9f6491d1d8..8d56af2c4e 100644
--- a/tests/functional/visibility_unapproved_posts_test.php
+++ b/tests/functional/visibility_unapproved_posts_test.php
@@ -162,7 +162,7 @@ class phpbb_functional_visibility_unapproved_test extends phpbb_functional_test_
$this->create_user('unapproved_posts_test_user#2');
$this->login('unapproved_posts_test_user#2');
- $this->add_lang('posting', 'viewtopic', 'mcp');
+ $this->add_lang(['posting', 'viewtopic', 'mcp']);
// should be able to see topic 1 but not unapproved post
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Unapproved Posts Test Topic #1']}&sid={$this->sid}");
diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php
index d1e3481b38..bc775d87ec 100644
--- a/tests/functions/build_url_test.php
+++ b/tests/functions/build_url_test.php
@@ -79,7 +79,7 @@ class phpbb_build_url_test extends phpbb_test_case
*/
public function test_build_url($page, $strip_vars, $expected)
{
- global $user, $phpbb_root_path;
+ global $user;
$user->page['page'] = $page;
$output = build_url($strip_vars);
diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php
index 0f9975bcac..b23c38854b 100644
--- a/tests/functions/generate_string_list.php
+++ b/tests/functions/generate_string_list.php
@@ -15,7 +15,7 @@ class phpbb_generate_string_list_test extends phpbb_test_case
{
public $user;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functions/make_clickable_email_test.php b/tests/functions/make_clickable_email_test.php
index 18ad789705..47b9edcdbb 100644
--- a/tests/functions/make_clickable_email_test.php
+++ b/tests/functions/make_clickable_email_test.php
@@ -17,7 +17,7 @@ class phpbb_functions_make_clickable_email_test extends phpbb_test_case
{
parent::setUp();
- global $config, $user, $request, $symfony_request;
+ global $user, $request, $symfony_request;
$user = new phpbb_mock_user();
$request = new phpbb_mock_request();
$symfony_request = new \phpbb\symfony_request($request);
diff --git a/tests/functions/make_clickable_test.php b/tests/functions/make_clickable_test.php
index d8d5eb5e0e..8a824f5cfa 100644
--- a/tests/functions/make_clickable_test.php
+++ b/tests/functions/make_clickable_test.php
@@ -158,7 +158,7 @@ class phpbb_functions_make_clickable_test extends phpbb_test_case
{
parent::setUp();
- global $config, $user, $request, $symfony_request;
+ global $user, $request, $symfony_request;
$user = new phpbb_mock_user();
$request = new phpbb_mock_request();
$symfony_request = new \phpbb\symfony_request($request);
diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php
index e6929b1549..f8e9ad45b1 100644
--- a/tests/functions/obtain_online_test.php
+++ b/tests/functions/obtain_online_test.php
@@ -13,6 +13,8 @@
class phpbb_functions_obtain_online_test extends phpbb_database_test_case
{
+ protected $db;
+
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/obtain_online.xml');
diff --git a/tests/functions/phpbb_get_banned_user_ids.php b/tests/functions/phpbb_get_banned_user_ids.php
index e1cb7a4636..cbabb85485 100644
--- a/tests/functions/phpbb_get_banned_user_ids.php
+++ b/tests/functions/phpbb_get_banned_user_ids.php
@@ -43,7 +43,7 @@ class phpbb_get_banned_user_ids_test extends phpbb_database_test_case
);
}
- public function setUp(): void
+ protected function setUp(): void
{
global $db;
diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php
index f4ea5696b9..27e1acefdd 100644
--- a/tests/functions/user_delete_test.php
+++ b/tests/functions/user_delete_test.php
@@ -76,10 +76,7 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case
$config,
$db,
$passwords_manager,
- $request,
- $user,
- $phpbb_root_path,
- $phpEx
+ $user
);
$oauth_provider = new \phpbb\auth\provider\oauth\oauth(
diff --git a/tests/functions_content/get_username_string_test.php b/tests/functions_content/get_username_string_test.php
index ac36e37e93..94ac99f272 100644
--- a/tests/functions_content/get_username_string_test.php
+++ b/tests/functions_content/get_username_string_test.php
@@ -13,7 +13,7 @@
class phpbb_functions_content_get_username_string_test extends phpbb_test_case
{
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/functions_content/phpbb_format_quote_test.php b/tests/functions_content/phpbb_format_quote_test.php
index 52a792517a..eed1ec5e46 100644
--- a/tests/functions_content/phpbb_format_quote_test.php
+++ b/tests/functions_content/phpbb_format_quote_test.php
@@ -18,7 +18,7 @@ class phpbb_functions_content_phpbb_format_quote_test extends phpbb_test_case
/** @var \phpbb\language\language */
protected $lang;
- public function setUp(): void
+ protected function setUp(): void
{
global $cache, $user, $phpbb_root_path, $phpEx;
diff --git a/tests/functions_user/delete_user_test.php b/tests/functions_user/delete_user_test.php
index 52fb4f3d42..aee21e33bd 100644
--- a/tests/functions_user/delete_user_test.php
+++ b/tests/functions_user/delete_user_test.php
@@ -196,8 +196,6 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
*/
public function test_first_last_post_info($mode, $retain_username, $expected_posts, $expected_topics, $expected_forums)
{
- global $cache, $config, $db, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx;
-
$this->assertFalse(user_delete($mode, 2, $retain_username));
$sql = 'SELECT post_id, poster_id, post_username
diff --git a/tests/group/helper_test_case.php b/tests/group/helper_test_case.php
index 099887bcb0..99d36197ac 100644
--- a/tests/group/helper_test_case.php
+++ b/tests/group/helper_test_case.php
@@ -116,7 +116,7 @@ class phpbb_group_helper_test_case extends phpbb_test_case
$this->group_helper = new \phpbb\group\helper($auth, $cache_service, $config, $lang, $phpbb_dispatcher, $path_helper, $user);
}
- public function setUp()
+ protected function setUp()
{
$this->setup_engine();
}
diff --git a/tests/groupposition/legend_test.php b/tests/groupposition/legend_test.php
index 66fc909770..121a2981bc 100644
--- a/tests/groupposition/legend_test.php
+++ b/tests/groupposition/legend_test.php
@@ -32,36 +32,28 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
*/
public function test_get_group_value($group_id, $expected, $throws_exception)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
if ($throws_exception)
{
$this->expectException($throws_exception);
}
- $test_class = new \phpbb\groupposition\legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db);
$this->assertEquals($expected, $test_class->get_group_value($group_id));
}
public function test_get_group_count()
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db);
$this->assertEquals(2, $test_class->get_group_count());
}
@@ -94,16 +86,12 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
*/
public function test_add_group($group_id, $expected_added, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db);
$this->assertEquals($expected_added, $test_class->add_group($group_id));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -184,16 +172,12 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
*/
public function test_delete_group($group_id, $skip_group, $expected_deleted, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db);
$this->assertEquals($expected_deleted, $test_class->delete_group($group_id, $skip_group));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -241,16 +225,12 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
*/
public function test_move_up($group_id, $excepted_moved, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db);
$this->assertEquals($excepted_moved, $test_class->move_up($group_id));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -298,16 +278,12 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
*/
public function test_move_down($group_id, $excepted_moved, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db);
$this->assertEquals($excepted_moved, $test_class->move_down($group_id));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -398,16 +374,12 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
*/
public function test_move($group_id, $increment, $excepted_moved, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db);
$this->assertEquals($excepted_moved, $test_class->move($group_id, $increment));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -417,4 +389,3 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$this->assertEquals($expected, $db->sql_fetchrowset($result));
}
}
-
diff --git a/tests/groupposition/teampage_test.php b/tests/groupposition/teampage_test.php
index 8598e5cfb0..c3888ae261 100644
--- a/tests/groupposition/teampage_test.php
+++ b/tests/groupposition/teampage_test.php
@@ -32,36 +32,28 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
*/
public function test_get_group_value($group_id, $expected, $throws_exception)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
if ($throws_exception)
{
$this->expectException($throws_exception);
}
- $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $cache);
$this->assertEquals($expected, $test_class->get_group_value($group_id));
}
public function test_get_group_count()
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $cache);
$this->assertEquals(8, $test_class->get_group_count());
}
@@ -138,16 +130,12 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
*/
public function test_add_group_teampage($group_id, $parent_id, $expected_added, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $cache);
$this->assertEquals($expected_added, $test_class->add_group_teampage($group_id, $parent_id));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -183,16 +171,12 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
*/
public function test_add_category_teampage($group_name, $expected_added, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $cache);
$this->assertEquals($expected_added, $test_class->add_category_teampage($group_name));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -252,16 +236,12 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
*/
public function test_delete_group($group_id, $expected_deleted, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $cache);
$this->assertEquals($expected_deleted, $test_class->delete_group($group_id, false));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -306,16 +286,12 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
*/
public function test_delete_teampage($teampage_id, $expected_deleted, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $cache);
$this->assertEquals($expected_deleted, $test_class->delete_teampage($teampage_id, false));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -471,16 +447,12 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
*/
public function test_move($group_id, $move_delta, $excepted_moved, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $cache);
$this->assertEquals($excepted_moved, $test_class->move($group_id, $move_delta));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -636,16 +608,12 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
*/
public function test_move_teampage($teampage_id, $move_delta, $excepted_moved, $expected)
{
- global $cache, $phpbb_root_path, $phpEx;
+ global $cache;
$cache = new phpbb_mock_cache;
$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');
- $user->lang = array();
- $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $cache);
$this->assertEquals($excepted_moved, $test_class->move_teampage($teampage_id, $move_delta));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -655,4 +623,3 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$this->assertEquals($expected, $db->sql_fetchrowset($result));
}
}
-
diff --git a/tests/help/manager_test.php b/tests/help/manager_test.php
index 118a38ad3e..e841a23a53 100644
--- a/tests/help/manager_test.php
+++ b/tests/help/manager_test.php
@@ -20,7 +20,7 @@ class phpbb_help_manager_test extends phpbb_test_case
/** @var \phpbb\language\language */
protected $language;
- public function setUp(): void
+ protected function setUp(): void
{
$this->template = $this->getMockBuilder('\phpbb\template\template')
->disableOriginalConstructor()
diff --git a/tests/installer/database_helper_test.php b/tests/installer/database_helper_test.php
index 9ffdad3e03..03c9152a5b 100644
--- a/tests/installer/database_helper_test.php
+++ b/tests/installer/database_helper_test.php
@@ -18,7 +18,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case
*/
private $database_helper;
- public function setUp(): void
+ protected function setUp(): void
{
$filesystem = new \phpbb\filesystem\filesystem();
$phpbb_root_path = '';
diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php
index 6fa8248b68..9b08dc3b26 100644
--- a/tests/installer/installer_config_test.php
+++ b/tests/installer/installer_config_test.php
@@ -20,7 +20,7 @@ class phpbb_installer_config_test extends phpbb_test_case
*/
private $config;
- public function setUp(): void
+ protected function setUp(): void
{
$phpbb_root_path = __DIR__ . './../../phpBB/';
$filesystem = $this->createMock('\phpbb\filesystem\filesystem');
diff --git a/tests/installer/module_base_test.php b/tests/installer/module_base_test.php
index 887d29f4c6..d28ce27629 100644
--- a/tests/installer/module_base_test.php
+++ b/tests/installer/module_base_test.php
@@ -26,7 +26,7 @@ class module_base_test extends phpbb_test_case
*/
protected $container;
- public function setUp(): void
+ protected function setUp(): void
{
// DI container mock
$this->container = new phpbb_mock_container_builder();
@@ -43,7 +43,7 @@ class module_base_test extends phpbb_test_case
$this->module = new test_installer_module($module_collection, true, false);
$iohandler = $this->createMock('\phpbb\install\helper\iohandler\iohandler_interface');
- $config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), '', 'php');
+ $config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), '');
$this->module->setup($config, $iohandler);
}
diff --git a/tests/language/language_test.php b/tests/language/language_test.php
index 8b822472cd..2b1b245491 100644
--- a/tests/language/language_test.php
+++ b/tests/language/language_test.php
@@ -16,7 +16,7 @@ class phpbb_language_test extends phpbb_test_case
/** @var \phpbb\language\language */
protected $lang;
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_root_path, $phpEx;
diff --git a/tests/lint_test.php b/tests/lint_test.php
index 8356389acf..2df572777a 100644
--- a/tests/lint_test.php
+++ b/tests/lint_test.php
@@ -14,7 +14,6 @@
class phpbb_lint_test extends phpbb_test_case
{
static protected $php_binary;
- static protected $exclude;
static public function setUpBeforeClass()
{
diff --git a/tests/lock/db_test.php b/tests/lock/db_test.php
index e96920ed1f..c940422f0a 100644
--- a/tests/lock/db_test.php
+++ b/tests/lock/db_test.php
@@ -22,7 +22,7 @@ class phpbb_lock_db_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/config.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $db, $config;
diff --git a/tests/log/add_test.php b/tests/log/add_test.php
index 469d4ebd69..ff9bedbe19 100644
--- a/tests/log/add_test.php
+++ b/tests/log/add_test.php
@@ -23,7 +23,6 @@ class phpbb_log_add_test extends phpbb_database_test_case
global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher;
$db = $this->new_dbal();
- $cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
@@ -54,7 +53,6 @@ class phpbb_log_add_test extends phpbb_database_test_case
global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher;
$db = $this->new_dbal();
- $cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
@@ -68,7 +66,6 @@ class phpbb_log_add_test extends phpbb_database_test_case
$log_ip = 'user_ip';
$log_time = time();
$log_operation = 'LOG_OPERATION';
- $additional_data = array();
// Add an entry successful
$this->assertEquals(1, $log->add($mode, $user_id, $log_ip, $log_operation, $log_time));
diff --git a/tests/log/function_add_log_test.php b/tests/log/function_add_log_test.php
index c3f1a0beba..ca1acbfbb3 100644
--- a/tests/log/function_add_log_test.php
+++ b/tests/log/function_add_log_test.php
@@ -159,10 +159,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->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $user = $this->createMock('\phpbb\user');
$auth = $this->createMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
diff --git a/tests/migrations/migrations_check_config_added_test.php b/tests/migrations/migrations_check_config_added_test.php
index 9c34428dae..cf3f8e9ea0 100644
--- a/tests/migrations/migrations_check_config_added_test.php
+++ b/tests/migrations/migrations_check_config_added_test.php
@@ -48,6 +48,7 @@ class migrations_check_config_added_test extends phpbb_test_case
$this->php_ext,
$this->table_prefix,
[],
+ [],
new \phpbb\db\migration\helper()
);
$this->container->set('migrator', $this->migrator);
diff --git a/tests/migrator/convert_timezones_test.php b/tests/migrator/convert_timezones_test.php
index 5bb8d7ab93..1b789fa388 100644
--- a/tests/migrator/convert_timezones_test.php
+++ b/tests/migrator/convert_timezones_test.php
@@ -13,7 +13,7 @@
class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
{
- protected $notifications, $db, $container, $user, $config, $auth, $cache;
+ protected $db;
public function getDataSet()
{
diff --git a/tests/migrator/get_callable_from_step_test.php b/tests/migrator/get_callable_from_step_test.php
index 809b977d57..33f1e1e960 100644
--- a/tests/migrator/get_callable_from_step_test.php
+++ b/tests/migrator/get_callable_from_step_test.php
@@ -13,7 +13,7 @@
class get_callable_from_step_test extends phpbb_database_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_root_path, $php_ext, $table_prefix, $phpbb_log, $user;
@@ -22,7 +22,6 @@ class get_callable_from_step_test extends phpbb_database_test_case
$phpbb_log = $this->getMockBuilder('\phpbb\log\log')->disableOriginalConstructor()->getMock();
$db = $this->new_dbal();
$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(
@@ -33,7 +32,7 @@ class get_callable_from_step_test extends phpbb_database_test_case
$phpbb_root_path,
$php_ext
);
- $module_tools = new \phpbb\db\migration\tool\module($db, $cache_service, $user, $module_manager, $phpbb_root_path, $php_ext, 'phpbb_modules');
+ $module_tools = new \phpbb\db\migration\tool\module($db, $user, $module_manager, 'phpbb_modules');
$this->migrator = new \phpbb\db\migrator(
new phpbb_mock_container_builder(),
new \phpbb\config\config(array()),
diff --git a/tests/migrator/get_schema_steps_test.php b/tests/migrator/get_schema_steps_test.php
index 10accb3d68..9b5e6c6697 100644
--- a/tests/migrator/get_schema_steps_test.php
+++ b/tests/migrator/get_schema_steps_test.php
@@ -13,7 +13,7 @@
class get_schema_steps_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/migrator/reverse_update_data_test.php b/tests/migrator/reverse_update_data_test.php
index b93680c2e2..83ae8e780d 100644
--- a/tests/migrator/reverse_update_data_test.php
+++ b/tests/migrator/reverse_update_data_test.php
@@ -16,7 +16,7 @@ class reverse_update_data_test extends phpbb_test_case
/** @var \phpbb\db\migration\helper */
protected $helper;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php
index dd7158cbfd..2ef5c2e5e1 100644
--- a/tests/migrator/schema_generator_test.php
+++ b/tests/migrator/schema_generator_test.php
@@ -24,7 +24,7 @@ class schema_generator_test extends phpbb_test_case
/** @var \phpbb\db\migration\schema_generator */
protected $generator;
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_root_path, $phpEx;
diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php
index 238e7ae2d6..7ba5d80ea6 100644
--- a/tests/mimetype/guesser_test.php
+++ b/tests/mimetype/guesser_test.php
@@ -27,7 +27,7 @@ class guesser_test extends \phpbb_test_case
protected $fileinfo_supported = false;
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_root_path;
diff --git a/tests/mock/user.php b/tests/mock/user.php
index d9211369bc..5352a22b27 100644
--- a/tests/mock/user.php
+++ b/tests/mock/user.php
@@ -23,7 +23,8 @@ class phpbb_mock_user
public $page = array('root_script_path' => '/');
public $style = [];
public $data = [];
-
+ public $lang = [];
+
private $options = array();
public function optionget($item)
{
@@ -31,10 +32,10 @@ class phpbb_mock_user
{
throw new Exception(sprintf("You didn't set the option '%s' on the mock user using optionset.", $item));
}
-
+
return $this->options[$item];
}
-
+
public function optionset($item, $value)
{
$this->options[$item] = $value;
diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php
index f5f0013770..51931f3f48 100644
--- a/tests/notification/group_request_test.php
+++ b/tests/notification/group_request_test.php
@@ -40,12 +40,10 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
include_once($phpbb_root_path . 'includes/functions_content.' . $phpEx);
$this->container->set('groupposition.legend', new \phpbb\groupposition\legend(
- $this->db,
- $this->user
+ $this->db
));
$this->container->set('groupposition.teampage', new \phpbb\groupposition\teampage(
$this->db,
- $this->user,
$this->cache->get_driver()
));
$this->container->set('group_helper', new \phpbb\group\helper(
diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php
index 11852473d1..f55870347f 100644
--- a/tests/notification/submit_post_base.php
+++ b/tests/notification/submit_post_base.php
@@ -47,7 +47,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/submit_post_' . $this->item_type . '.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -95,10 +95,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
$storage = $this->createMock('\phpbb\storage\storage');
// User
- $user = $this->createMock('\phpbb\user', array(), array(
- $lang,
- '\phpbb\datetime'
- ));
+ $user = $this->createMock('\phpbb\user');
$user->ip = '';
$user->data = array(
'user_id' => 2,
diff --git a/tests/notification/submit_post_type_bookmark_test.php b/tests/notification/submit_post_type_bookmark_test.php
index 9af247b3c3..073dcf03e7 100644
--- a/tests/notification/submit_post_type_bookmark_test.php
+++ b/tests/notification/submit_post_type_bookmark_test.php
@@ -17,7 +17,7 @@ class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notificati
{
protected $item_type = 'notification.type.bookmark';
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/notification/submit_post_type_post_in_queue_test.php b/tests/notification/submit_post_type_post_in_queue_test.php
index bced0ea48c..a53e6e386b 100644
--- a/tests/notification/submit_post_type_post_in_queue_test.php
+++ b/tests/notification/submit_post_type_post_in_queue_test.php
@@ -17,7 +17,7 @@ class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notif
{
protected $item_type = 'notification.type.post_in_queue';
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/notification/submit_post_type_post_test.php b/tests/notification/submit_post_type_post_test.php
index 5580d0924e..69fca75f11 100644
--- a/tests/notification/submit_post_type_post_test.php
+++ b/tests/notification/submit_post_type_post_test.php
@@ -17,7 +17,7 @@ class phpbb_notification_submit_post_type_post_test extends phpbb_notification_s
{
protected $item_type = 'notification.type.post';
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php
index 655f12661b..b4469bdaff 100644
--- a/tests/notification/submit_post_type_quote_test.php
+++ b/tests/notification/submit_post_type_quote_test.php
@@ -17,7 +17,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_
{
protected $item_type = 'notification.type.quote';
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php
index 070b2fa21e..a2adfcdda8 100644
--- a/tests/notification/submit_post_type_topic_test.php
+++ b/tests/notification/submit_post_type_topic_test.php
@@ -17,7 +17,7 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_
{
protected $item_type = 'notification.type.topic';
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php
index bf3058c342..0542d6ab78 100644
--- a/tests/notification/user_list_trim_test.php
+++ b/tests/notification/user_list_trim_test.php
@@ -20,7 +20,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_list_trim.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $user, $cache, $auth;
diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php
index 0f9b6661be..77f621b8db 100644
--- a/tests/pagination/pagination_test.php
+++ b/tests/pagination/pagination_test.php
@@ -22,17 +22,14 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
return implode('-', func_get_args());
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $this->user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $this->user = $this->createMock('\phpbb\user');
$this->user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
@@ -45,7 +42,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
);
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $manager);
- $router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
+ $router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, 'php', dirname(__FILE__) . '/');
$request = new phpbb_mock_request();
$request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);
diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php
index 37b333e23a..cb8c58b54e 100644
--- a/tests/passwords/drivers_test.php
+++ b/tests/passwords/drivers_test.php
@@ -13,7 +13,7 @@
class phpbb_passwords_helper_test extends \phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
// Prepare dependencies for drivers
$config = new \phpbb\config\config(array());
diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php
index 90dbb47f46..dd2f61991e 100644
--- a/tests/passwords/manager_test.php
+++ b/tests/passwords/manager_test.php
@@ -19,7 +19,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case
protected $default_pw = 'foobar';
- public function setUp(): void
+ protected function setUp(): void
{
// Prepare dependencies for manager and driver
$config = new \phpbb\config\config(array());
@@ -301,13 +301,13 @@ class phpbb_passwords_manager_test extends \phpbb_test_case
{
if ($use_new_interface)
{
- $test_driver = $this->createMock('\phpbb\passwords\driver\rehashable_driver_interface', array('needs_rehash', 'get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only'));
+ $test_driver = $this->createMock('\phpbb\passwords\driver\rehashable_driver_interface');
$test_driver->method('needs_rehash')
->willReturn($needs_rehash);
}
else
{
- $test_driver = $this->createMock('\phpbb\passwords\driver\driver_interface', array('get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only'));
+ $test_driver = $this->createMock('\phpbb\passwords\driver\driver_interface');
}
$config = new \phpbb\config\config(array());
diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php
index bca0f0eb07..49e431eed1 100644
--- a/tests/path_helper/path_helper_test.php
+++ b/tests/path_helper/path_helper_test.php
@@ -19,7 +19,7 @@ class phpbb_path_helper_test extends phpbb_test_case
protected $path_helper;
protected $phpbb_root_path = '';
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -165,9 +165,7 @@ class phpbb_path_helper_test extends phpbb_test_case
*/
public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction)
{
- $symfony_request = $this->createMock('\phpbb\symfony_request', array(), array(
- new phpbb_mock_request(),
- ));
+ $symfony_request = $this->createMock('\phpbb\symfony_request');
$symfony_request->expects($this->any())
->method('getPathInfo')
->will($this->returnValue($getPathInfo));
@@ -185,7 +183,7 @@ class phpbb_path_helper_test extends phpbb_test_case
'php'
);
- $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input, $symfony_request));
+ $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input));
}
public function clean_url_data()
diff --git a/tests/privmsgs/delete_user_pms_test.php b/tests/privmsgs/delete_user_pms_test.php
index f1d717f03c..40f50ee976 100644
--- a/tests/privmsgs/delete_user_pms_test.php
+++ b/tests/privmsgs/delete_user_pms_test.php
@@ -85,7 +85,7 @@ class phpbb_privmsgs_delete_user_pms_test extends phpbb_database_test_case
*/
public function test_delete_user_pms($delete_user, $remaining_privmsgs, $remaining_privmsgs_to)
{
- global $db, $phpbb_container, $phpbb_root_path;
+ global $db, $phpbb_container;
$db = $this->new_dbal();
diff --git a/tests/profilefields/manager_test.php b/tests/profilefields/manager_test.php
index 191869d62b..1bf40550ca 100644
--- a/tests/profilefields/manager_test.php
+++ b/tests/profilefields/manager_test.php
@@ -39,7 +39,7 @@ class manager_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/manager.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -55,9 +55,6 @@ class manager_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder();
$dispatcher = new phpbb_mock_event_dispatcher();
- $request = $this->getMockBuilder('\phpbb\request\request')
- ->disableOriginalConstructor()
- ->getMock();
$template = $this->getMockBuilder('\phpbb\template\template')
->disableOriginalConstructor()
->getMock();
@@ -77,7 +74,6 @@ class manager_test extends phpbb_database_test_case
$dispatcher,
$language,
$this->log,
- $request,
$template,
$collection,
$user,
diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index 3e7cace288..8806e2fadd 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -23,10 +23,8 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
* @access public
* @return void
*/
- public function setUp(): void
+ protected function setUp(): void
{
- global $phpbb_root_path, $phpEx;
-
$db = $this->createMock('phpbb\\db\\driver\\driver');
$user = $this->createMock('\phpbb\user');
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index b70aa60368..7b2d4112dc 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -20,17 +20,11 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
/**
* Sets up basic test objects
*
- * @access public
- * @return null
+ * @access protected
*/
- public function setUp(): void
+ protected function setUp(): void
{
- global $phpbb_root_path, $phpEx;
-
- $this->user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $this->user = $this->createMock('\phpbb\user');
$this->user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index 738801d524..86cd413240 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -20,13 +20,10 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
/**
* Sets up basic test objects
*
- * @access public
- * @return null
+ * @access protected
*/
- public function setUp(): void
+ protected function setUp(): void
{
- global $phpbb_root_path, $phpEx;
-
$db = $this->createMock('phpbb\\db\\driver\\driver');
$user = $this->createMock('\phpbb\user');
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index 943f130835..733f397911 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -19,17 +19,11 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
/**
* Sets up basic test objects
*
- * @access public
- * @return null
+ * @access protected
*/
- public function setUp(): void
+ protected function setUp(): void
{
- global $phpbb_root_path, $phpEx;
-
- $user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $user = $this->createMock('\phpbb\user');
$user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 19bfbbc926..a8d0399fd4 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -19,17 +19,13 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
/**
* Sets up basic test objects
*
- * @access public
- * @return null
+ * @access protected
*/
- public function setUp(): void
+ protected function setUp(): void
{
- global $config, $request, $user, $cache, $phpbb_root_path, $phpEx;
+ global $config, $request, $user, $cache;
- $user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $user = $this->createMock('\phpbb\user');
$cache = new phpbb_mock_cache;
$user->expects($this->any())
->method('lang')
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index 5ed5fb4c2f..d203234f2a 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -23,19 +23,15 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
/**
* Sets up basic test objects
*
- * @access public
- * @return null
+ * @access protected
*/
- public function setUp(): void
+ protected function setUp(): void
{
- global $config, $request, $user, $cache, $phpbb_root_path, $phpEx;
+ global $config, $request, $user, $cache;
$config = new \phpbb\config\config([]);
$cache = new phpbb_mock_cache;
- $user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $user = $this->createMock('\phpbb\user');
$user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/random/gen_rand_string_test.php b/tests/random/gen_rand_string_test.php
index 044fd3cc15..13ca0df245 100644
--- a/tests/random/gen_rand_string_test.php
+++ b/tests/random/gen_rand_string_test.php
@@ -17,7 +17,7 @@ class phpbb_random_gen_rand_string_test extends phpbb_test_case
const MIN_STRING_LENGTH = 1;
const MAX_STRING_LENGTH = 15;
- public function setUp(): void
+ protected function setUp(): void
{
global $config;
diff --git a/tests/regex/email_test.php b/tests/regex/email_test.php
index 7b10b0a6ef..b281941c49 100644
--- a/tests/regex/email_test.php
+++ b/tests/regex/email_test.php
@@ -15,7 +15,7 @@ class phpbb_regex_email_test extends phpbb_test_case
{
protected $regex;
- public function setUp(): void
+ protected function setUp(): void
{
$this->regex = '#^' . get_preg_expression('email') . '$#i';
}
diff --git a/tests/regex/ipv4_test.php b/tests/regex/ipv4_test.php
index 5d859c240b..1bd8948b87 100644
--- a/tests/regex/ipv4_test.php
+++ b/tests/regex/ipv4_test.php
@@ -15,7 +15,7 @@ class phpbb_regex_ipv4_test extends phpbb_test_case
{
protected $regex;
- public function setUp(): void
+ protected function setUp(): void
{
$this->regex = get_preg_expression('ipv4');
}
diff --git a/tests/regex/ipv6_test.php b/tests/regex/ipv6_test.php
index d4a86015ae..92e74a0220 100644
--- a/tests/regex/ipv6_test.php
+++ b/tests/regex/ipv6_test.php
@@ -15,7 +15,7 @@ class phpbb_regex_ipv6_test extends phpbb_test_case
{
protected $regex;
- public function setUp(): void
+ protected function setUp(): void
{
$this->regex = get_preg_expression('ipv6');
}
diff --git a/tests/search/common_test_case.php b/tests/search/common_test_case.php
index d157d3ae7e..892e05ab4b 100644
--- a/tests/search/common_test_case.php
+++ b/tests/search/common_test_case.php
@@ -15,6 +15,8 @@ require_once dirname(__FILE__) . '/../test_framework/phpbb_search_test_case.php'
abstract class phpbb_search_common_test_case extends phpbb_search_test_case
{
+ protected $search;
+
public function keywords()
{
return array(
diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php
index 7d3917296e..950c4876fc 100644
--- a/tests/search/mysql_test.php
+++ b/tests/search/mysql_test.php
@@ -16,7 +16,6 @@ require_once dirname(__FILE__) . '/common_test_case.php';
class phpbb_search_mysql_test extends phpbb_search_common_test_case
{
protected $db;
- protected $search;
public function getDataSet()
{
diff --git a/tests/search/native_test.php b/tests/search/native_test.php
index ba37660b1f..db547bd844 100644
--- a/tests/search/native_test.php
+++ b/tests/search/native_test.php
@@ -16,7 +16,6 @@ require_once dirname(__FILE__) . '/../test_framework/phpbb_search_test_case.php'
class phpbb_search_native_test extends phpbb_search_test_case
{
protected $db;
- protected $search;
public function getDataSet()
{
diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php
index 7e2a6cec85..441632f27d 100644
--- a/tests/search/postgres_test.php
+++ b/tests/search/postgres_test.php
@@ -16,7 +16,6 @@ require_once dirname(__FILE__) . '/common_test_case.php';
class phpbb_search_postgres_test extends phpbb_search_common_test_case
{
protected $db;
- protected $search;
public function getDataSet()
{
diff --git a/tests/security/hash_test.php b/tests/security/hash_test.php
index 40d14f24bf..49eefa3411 100644
--- a/tests/security/hash_test.php
+++ b/tests/security/hash_test.php
@@ -13,7 +13,7 @@
class phpbb_security_hash_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
global $phpbb_container;
diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php
index 0ee655f4ac..96e550609e 100644
--- a/tests/session/check_ban_test.php
+++ b/tests/session/check_ban_test.php
@@ -38,7 +38,7 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
);
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
// Get session here so that config is mocked correctly
@@ -60,7 +60,7 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
);
}
- public function tearDown(): void
+ protected function tearDown(): void
{
parent::tearDown();
// Set cache back to what it was before the test changed it
diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php
index ec248b2904..1c54e79428 100644
--- a/tests/session/garbage_collection_test.php
+++ b/tests/session/garbage_collection_test.php
@@ -22,7 +22,7 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_garbage.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->session = $this->session_factory->get_session($this->db);
diff --git a/tests/storage/adapter/local_subfolders_test.php b/tests/storage/adapter/local_subfolders_test.php
index de02fceefa..3ff4de7f42 100644
--- a/tests/storage/adapter/local_subfolders_test.php
+++ b/tests/storage/adapter/local_subfolders_test.php
@@ -19,7 +19,7 @@
protected $filesystem;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -33,7 +33,7 @@
mkdir($this->path);
}
- public function tearDown(): void
+ protected function tearDown(): void
{
$this->adapter = null;
rmdir($this->path);
diff --git a/tests/storage/adapter/local_test.php b/tests/storage/adapter/local_test.php
index e44f0e2023..7b2a2af117 100644
--- a/tests/storage/adapter/local_test.php
+++ b/tests/storage/adapter/local_test.php
@@ -19,7 +19,7 @@
protected $filesystem;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -33,7 +33,7 @@
mkdir($this->path);
}
- public function tearDown(): void
+ protected function tearDown(): void
{
$this->adapter = null;
rmdir($this->path);
diff --git a/tests/template/asset_test.php b/tests/template/asset_test.php
index 3d2fdd8959..8467732bda 100644
--- a/tests/template/asset_test.php
+++ b/tests/template/asset_test.php
@@ -41,7 +41,7 @@ class phpbb_template_asset_test extends phpbb_test_case
$path_helper->method('get_phpbb_root_path')
->willReturn($phpbb_root_path);
- $asset = new asset('', $path_helper, new phpbb\filesystem\filesystem());
+ $asset = new asset('', $path_helper);
$asset->set_path($path, true);
$this->assertEquals($expected, $asset->get_path());
diff --git a/tests/template/extension_test.php b/tests/template/extension_test.php
index 5d73aed91e..2320aa2331 100644
--- a/tests/template/extension_test.php
+++ b/tests/template/extension_test.php
@@ -90,7 +90,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
$cache_path,
null,
$loader,
- new \phpbb\event\dispatcher($phpbb_container),
+ new \phpbb\event\dispatcher(),
[
'cache' => false,
'debug' => false,
diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php
index de4d663fb8..c322923fb1 100644
--- a/tests/template/template_allfolder_test.php
+++ b/tests/template/template_allfolder_test.php
@@ -55,7 +55,6 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
)
);
- $container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader('');
@@ -66,7 +65,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
$cache_path,
$this->extension_manager,
$loader,
- new \phpbb\event\dispatcher($container),
+ new \phpbb\event\dispatcher(),
array(
'cache' => false,
'debug' => false,
diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php
index 7693e84db9..786f1af583 100644
--- a/tests/template/template_events_test.php
+++ b/tests/template/template_events_test.php
@@ -149,7 +149,6 @@ Zeta test event in all',
$phpEx
);
- $container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader('');
@@ -160,7 +159,7 @@ Zeta test event in all',
$cache_path,
$this->extension_manager,
$loader,
- new \phpbb\event\dispatcher($container),
+ new \phpbb\event\dispatcher(),
array(
'cache' => false,
'debug' => false,
diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php
index 9f90a00b1a..7206bc1d43 100644
--- a/tests/template/template_includecss_test.php
+++ b/tests/template/template_includecss_test.php
@@ -41,7 +41,6 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
$this->template_path = $this->test_path . '/templates';
$this->parent_template_path = $this->test_path . '/parent_templates';
- $container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader('');
@@ -52,7 +51,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
$cache_path,
null,
$loader,
- new \phpbb\event\dispatcher($container),
+ new \phpbb\event\dispatcher(),
array(
'cache' => false,
'debug' => false,
diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php
index 3a64d70f30..18b067bb30 100644
--- a/tests/template/template_test_case.php
+++ b/tests/template/template_test_case.php
@@ -93,7 +93,6 @@ class phpbb_template_template_test_case extends phpbb_test_case
$this->template_path = $this->test_path . '/templates';
- $container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader('');
@@ -104,7 +103,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
$cache_path,
null,
$loader,
- new \phpbb\event\dispatcher($container),
+ new \phpbb\event\dispatcher(),
array(
'cache' => false,
'debug' => false,
diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php
index d21baa3fd4..3db07196c4 100644
--- a/tests/template/template_test_case_with_tree.php
+++ b/tests/template/template_test_case_with_tree.php
@@ -36,7 +36,6 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
$this->template_path = $this->test_path . '/templates';
$this->parent_template_path = $this->test_path . '/parent_templates';
- $container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader('');
@@ -47,7 +46,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
$cache_path,
null,
$loader,
- new \phpbb\event\dispatcher($container),
+ new \phpbb\event\dispatcher(),
array(
'cache' => false,
'debug' => false,
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index 5ef545781c..b73baaeb94 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -359,7 +359,7 @@ abstract class phpbb_database_test_case extends TestCase
static $core_tables = [];
- if (empty($tables))
+ if (empty($core_tables))
{
$tables_yml_data = \Symfony\Component\Yaml\Yaml::parseFile($phpbb_root_path . '/config/default/container/tables.yml');
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 87b69fc88e..d107ce47d1 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -75,7 +75,7 @@ class phpbb_functional_test_case extends phpbb_test_case
return array();
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
@@ -524,9 +524,9 @@ class phpbb_functional_test_case extends phpbb_test_case
/**
* Creates a new style
*
- * @param string $style_id Style ID
+ * @param int $style_id Style ID
* @param string $style_path Style directory
- * @param string $parent_style_id Parent style id. Default = 1
+ * @param int $parent_style_id Parent style id. Default = 1
* @param string $parent_style_path Parent style directory. Default = 'prosilver'
*/
protected function add_style($style_id, $style_path, $parent_style_id = 1, $parent_style_path = 'prosilver')
@@ -600,7 +600,7 @@ class phpbb_functional_test_case extends phpbb_test_case
/**
* Remove temporary style created by add_style()
*
- * @param string $style_id Style ID
+ * @param int $style_id Style ID
* @param string $style_path Style directory
*/
protected function delete_style($style_id, $style_path)
@@ -720,10 +720,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $user = $this->createMock('\phpbb\user');
$auth = $this->createMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
@@ -757,10 +754,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->createMock('\phpbb\user', array(), array(
- new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
- '\phpbb\datetime'
- ));
+ $user = $this->createMock('\phpbb\user');
$auth = $this->createMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
@@ -806,7 +800,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$cookies = self::$cookieJar->all();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
- foreach ($cookies as $cookie);
+ foreach ($cookies as $cookie)
{
if (substr($cookie->getName(), -4) == '_sid')
{
@@ -855,7 +849,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$cookies = self::$cookieJar->all();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
- foreach ($cookies as $cookie);
+ foreach ($cookies as $cookie)
{
if (substr($cookie->getName(), -4) == '_sid')
{
diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php
index 377ec0d5f3..fa36535bb6 100644
--- a/tests/test_framework/phpbb_session_test_case.php
+++ b/tests/test_framework/phpbb_session_test_case.php
@@ -25,7 +25,7 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case
/** @var \phpbb\db\driver\driver_interface */
protected $db;
- function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php
new file mode 100644
index 0000000000..9c319963d8
--- /dev/null
+++ b/tests/test_framework/phpbb_ui_test_case.php
@@ -0,0 +1,744 @@
+
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+use Facebook\WebDriver\Chrome\ChromeOptions;
+use Facebook\WebDriver\WebDriverBy;
+use Facebook\WebDriver\Exception\WebDriverCurlException;
+use Facebook\WebDriver\Remote\RemoteWebDriver;
+use Facebook\WebDriver\Remote\DesiredCapabilities;
+
+require_once __DIR__ . '/mock/phpbb_mock_null_installer_task.php';
+
+class phpbb_ui_test_case extends phpbb_test_case
+{
+ static protected $host = '127.0.0.1';
+ static protected $port = 8910;
+
+ /**
+ * @var RemoteWebDriver
+ */
+ static protected $webDriver;
+
+ static protected $config;
+ static protected $root_url;
+ static protected $already_installed = false;
+ static protected $install_success = false;
+ protected $cache = null;
+ protected $db = null;
+ protected $extension_manager = null;
+
+ /**
+ * Session ID for current test's session (each test makes its own)
+ * @var string
+ */
+ protected $sid;
+
+ /**
+ * Language array used by phpBB
+ * @var array
+ */
+ protected $lang = array();
+
+ static public function setUpBeforeClass()
+ {
+ parent::setUpBeforeClass();
+
+ if (!class_exists('\Facebook\WebDriver\Remote\RemoteWebDriver'))
+ {
+ self::markTestSkipped(
+ 'Could not find RemoteWebDriver class.'
+ );
+ }
+
+ self::$config = phpbb_test_case_helpers::get_test_config();
+ self::$root_url = self::$config['phpbb_functional_url'];
+
+ // Important: this is used both for installation and by
+ // test cases for querying the tables.
+ // Therefore table prefix must be set before a board is
+ // installed, and also before each test case is run.
+ self::$config['table_prefix'] = 'phpbb_';
+
+ if (!isset(self::$config['phpbb_functional_url']))
+ {
+ self::markTestSkipped('phpbb_functional_url was not set in test_config and wasn\'t set as PHPBB_FUNCTIONAL_URL environment variable either.');
+ }
+
+ try {
+ $capabilities = DesiredCapabilities::chrome();
+ $chromeOptions = (new ChromeOptions)->addArguments(['headless', 'disable-gpu']);
+ $capabilities->setCapability(ChromeOptions::CAPABILITY, $chromeOptions);
+ self::$webDriver = RemoteWebDriver::create(
+ self::$host . ':' . self::$port,
+ $capabilities,
+ 30 * 1000, // 30 seconds connection timeout
+ 30 * 1000 // 30 seconds request timeout
+ );
+ } catch (WebDriverCurlException $e) {
+ self::markTestSkipped('PhantomJS webserver is not running.');
+ }
+
+ if (!self::$already_installed)
+ {
+ self::install_board();
+ self::$already_installed = true;
+ }
+ }
+
+ /**
+ * @return array List of extensions that should be set up
+ */
+ static protected function setup_extensions()
+ {
+ return array();
+ }
+
+ protected function setUp(): void
+ {
+ if (!self::$install_success)
+ {
+ $this->fail('Installing phpBB has failed.');
+ }
+
+ // Clear the language array so that things
+ // that were added in other tests are gone
+ $this->lang = array();
+ $this->add_lang('common');
+
+ $db = $this->get_db();
+
+ foreach (static::setup_extensions() as $extension)
+ {
+ $this->purge_cache();
+
+ $sql = 'SELECT ext_active
+ FROM ' . EXT_TABLE . "
+ WHERE ext_name = '" . $db->sql_escape($extension). "'";
+ $result = $db->sql_query($sql);
+ $status = (bool) $db->sql_fetchfield('ext_active');
+ $db->sql_freeresult($result);
+
+ if (!$status)
+ {
+ $this->install_ext($extension);
+ }
+ }
+ }
+
+ protected function tearDown(): void
+ {
+ parent::tearDown();
+
+ if ($this->db instanceof \phpbb\db\driver\driver_interface)
+ {
+ // Close the database connections again this test
+ $this->db->sql_close();
+ }
+ }
+
+ public function getDriver()
+ {
+ return self::$webDriver;
+ }
+
+ public function visit($path)
+ {
+ // Retry three times on curl issues, e.g. timeout
+ $attempts = 0;
+ $retries = 3;
+
+ while (true)
+ {
+ $attempts++;
+ try
+ {
+ $this->getDriver()->get(self::$root_url . $path);
+ break;
+ }
+ catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception)
+ {
+ if ($attempts >= $retries)
+ {
+ throw $exception;
+ }
+ }
+ }
+ }
+
+ static protected function recreate_database($config)
+ {
+ $db_conn_mgr = new phpbb_database_test_connection_manager($config);
+ $db_conn_mgr->recreate_db();
+ }
+
+ public function find_element($type, $value)
+ {
+ return $this->getDriver()->findElement(WebDriverBy::$type($value));
+ }
+
+ public function submit($type = 'id', $value = 'submit')
+ {
+ $element = $this->find_element($type, $value);
+ $element->click();
+ }
+
+ static protected function install_board()
+ {
+ global $phpbb_root_path, $phpEx, $db;
+
+ self::recreate_database(self::$config);
+
+ $config_file = $phpbb_root_path . "config.$phpEx";
+ $config_file_dev = $phpbb_root_path . "config_dev.$phpEx";
+ $config_file_test = $phpbb_root_path . "config_test.$phpEx";
+
+ if (file_exists($config_file))
+ {
+ if (!file_exists($config_file_dev))
+ {
+ rename($config_file, $config_file_dev);
+ }
+ else
+ {
+ unlink($config_file);
+ }
+ }
+
+ $install_config_file = $phpbb_root_path . 'store/install_config.php';
+
+ if (file_exists($install_config_file))
+ {
+ unlink($install_config_file);
+ }
+
+ $container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx);
+ $container = $container_builder
+ ->with_environment('installer')
+ ->without_extensions()
+ ->without_cache()
+ ->with_custom_parameters([
+ 'core.disable_super_globals' => false,
+ 'installer.create_config_file.options' => [
+ 'debug' => true,
+ 'environment' => 'test',
+ ],
+ 'cache.driver.class' => 'phpbb\cache\driver\file'
+ ])
+ ->with_config(new \phpbb\config_php_file($phpbb_root_path, $phpEx))
+ ->without_compiled_container()
+ ->get_container();
+
+ $container->register('installer.install_finish.notify_user')->setSynthetic(true);
+ $container->set('installer.install_finish.notify_user', new phpbb_mock_null_installer_task());
+ $container->register('installer.install_finish.install_extensions')->setSynthetic(true);
+ $container->set('installer.install_finish.install_extensions', new phpbb_mock_null_installer_task());
+ $container->compile();
+
+ $language = $container->get('language');
+ $language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting'));
+
+ $iohandler_factory = $container->get('installer.helper.iohandler_factory');
+ $iohandler_factory->set_environment('cli');
+ $iohandler = $iohandler_factory->get();
+
+ $parseURL = parse_url(self::$config['phpbb_functional_url']);
+
+ $output = new \Symfony\Component\Console\Output\NullOutput();
+ $style = new \Symfony\Component\Console\Style\SymfonyStyle(
+ new \Symfony\Component\Console\Input\ArrayInput(array()),
+ $output
+ );
+ $iohandler->set_style($style, $output);
+
+ $installer = $container->get('installer.installer.install');
+ $installer->set_iohandler($iohandler);
+
+ // Set data
+ $iohandler->set_input('admin_name', 'admin');
+ $iohandler->set_input('admin_pass1', 'adminadmin');
+ $iohandler->set_input('admin_pass2', 'adminadmin');
+ $iohandler->set_input('board_email', 'nobody@example.com');
+ $iohandler->set_input('submit_admin', 'submit');
+
+ $iohandler->set_input('default_lang', 'en');
+ $iohandler->set_input('board_name', 'yourdomain.com');
+ $iohandler->set_input('board_description', 'A short text to describe your forum');
+ $iohandler->set_input('submit_board', 'submit');
+
+ $iohandler->set_input('dbms', str_replace('phpbb\db\driver\\', '', self::$config['dbms']));
+ $iohandler->set_input('dbhost', self::$config['dbhost']);
+ $iohandler->set_input('dbport', self::$config['dbport']);
+ $iohandler->set_input('dbuser', self::$config['dbuser']);
+ $iohandler->set_input('dbpasswd', self::$config['dbpasswd']);
+ $iohandler->set_input('dbname', self::$config['dbname']);
+ $iohandler->set_input('table_prefix', self::$config['table_prefix']);
+ $iohandler->set_input('submit_database', 'submit');
+
+ $iohandler->set_input('email_enable', true);
+ $iohandler->set_input('smtp_delivery', '1');
+ $iohandler->set_input('smtp_host', 'nxdomain.phpbb.com');
+ $iohandler->set_input('smtp_auth', 'PLAIN');
+ $iohandler->set_input('smtp_user', 'nxuser');
+ $iohandler->set_input('smtp_pass', 'nxpass');
+ $iohandler->set_input('submit_email', 'submit');
+
+ $iohandler->set_input('cookie_secure', '0');
+ $iohandler->set_input('server_protocol', '0');
+ $iohandler->set_input('force_server_vars', $parseURL['scheme'] . '://');
+ $iohandler->set_input('server_name', $parseURL['host']);
+ $iohandler->set_input('server_port', isset($parseURL['port']) ? (int) $parseURL['port'] : 80);
+ $iohandler->set_input('script_path', $parseURL['path']);
+ $iohandler->set_input('submit_server', 'submit');
+
+ $installer->run();
+
+ copy($config_file, $config_file_test);
+
+ self::$install_success = true;
+
+ if (file_exists($phpbb_root_path . 'store/install_config.php'))
+ {
+ self::$install_success = false;
+ @unlink($phpbb_root_path . 'store/install_config.php');
+ }
+
+ if (file_exists($phpbb_root_path . 'cache/install_lock'))
+ {
+ @unlink($phpbb_root_path . 'cache/install_lock');
+ }
+
+ global $phpbb_container;
+ $phpbb_container->reset();
+
+ $blacklist = ['phpbb_class_loader_mock', 'phpbb_class_loader_ext', 'phpbb_class_loader'];
+
+ foreach (array_keys($GLOBALS) as $key)
+ {
+ if (is_object($GLOBALS[$key]) && !in_array($key, $blacklist, true))
+ {
+ unset($GLOBALS[$key]);
+ }
+ }
+ }
+
+ public function install_ext($extension)
+ {
+ $this->add_lang('acp/extensions');
+
+ $this->login();
+ $this->admin_login();
+
+ $ext_path = str_replace('/', '%2F', $extension);
+
+ $this->visit('adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
+ $this->assertNotEmpty(count($this->find_element('cssSelector', 'div.main fieldset.submit-buttons input.button2')));
+
+ $this->find_element('cssSelector', "input[value='" . $this->lang('EXTENSION_ENABLE') . "']")->submit();
+
+ try
+ {
+ $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
+
+ // Wait for extension to be fully enabled
+ while (count($meta_refresh))
+ {
+ preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match);
+ $this->getDriver()->execute(array('method' => 'post', 'url' => $match[1]));
+ $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
+ }
+ }
+ catch (\Facebook\WebDriver\Exception\NoSuchElementException $e)
+ {
+ // Probably no refresh triggered
+ }
+
+ $this->assertContainsLang('EXTENSION_ENABLE_SUCCESS', $this->find_element('cssSelector', 'div.successbox')->getText());
+
+ $this->logout();
+ }
+
+ public function disable_ext($extension)
+ {
+ $this->add_lang('acp/extensions');
+
+ $this->login();
+ $this->admin_login();
+
+ $ext_path = str_replace('/', '%2F', $extension);
+
+ $this->visit('adm/index.php?i=acp_extensions&mode=main&action=disable_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
+ $this->assertNotEmpty(count($this->find_element('cssSelector', 'div.main fieldset.submit-buttons input.button2')));
+
+ $this->find_element('cssSelector', "input[value='" . $this->lang('EXTENSION_DISABLE') . "']")->submit();
+
+ try
+ {
+ $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
+
+ // Wait for extension to be fully enabled
+ while (count($meta_refresh))
+ {
+ preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match);
+ $this->getDriver()->execute(array('method' => 'post', 'url' => $match[1]));
+ $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
+ }
+ }
+ catch (\Facebook\WebDriver\Exception\NoSuchElementException $e)
+ {
+ // Probably no refresh triggered
+ }
+
+ $this->assertContainsLang('EXTENSION_DISABLE_SUCCESS', $this->find_element('cssSelector', 'div.successbox')->getText());
+
+ $this->logout();
+ }
+
+ public function delete_ext_data($extension)
+ {
+ $this->add_lang('acp/extensions');
+
+ $this->login();
+ $this->admin_login();
+
+ $ext_path = str_replace('/', '%2F', $extension);
+
+ $this->visit('adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=' . $ext_path . '&sid=' . $this->sid);
+ $this->assertNotEmpty(count($this->find_element('cssSelector', 'div.main fieldset.submit-buttons input.button2')));
+
+ $this->find_element('cssSelector', "input[value='" . $this->lang('EXTENSION_DELETE_DATA') . "']")->submit();
+
+ try
+ {
+ $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
+
+ // Wait for extension to be fully enabled
+ while (count($meta_refresh))
+ {
+ preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match);
+ $this->getDriver()->execute(array('method' => 'post', 'url' => $match[1]));
+ $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]');
+ }
+ }
+ catch (\Facebook\WebDriver\Exception\NoSuchElementException $e)
+ {
+ // Probably no refresh triggered
+ }
+
+ $this->assertContainsLang('EXTENSION_DELETE_DATA_SUCCESS', $this->find_element('cssSelector', 'div.successbox')->getText());
+
+ $this->logout();
+ }
+
+ public function uninstall_ext($extension)
+ {
+ $this->disable_ext($extension);
+ $this->delete_ext_data($extension);
+ }
+
+ protected function get_cache_driver()
+ {
+ if (!$this->cache)
+ {
+ global $phpbb_container, $phpbb_root_path;
+
+ $phpbb_container = new phpbb_mock_container_builder();
+ $phpbb_container->setParameter('core.environment', PHPBB_ENVIRONMENT);
+ $phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/');
+
+ $this->cache = new \phpbb\cache\driver\file;
+ }
+
+ return $this->cache;
+ }
+
+ protected function purge_cache()
+ {
+ $cache = $this->get_cache_driver();
+
+ $cache->purge();
+ $cache->unload();
+ $cache->load();
+ }
+
+ protected function get_extension_manager()
+ {
+ global $phpbb_root_path, $phpEx;
+
+ $config = new \phpbb\config\config(array());
+ $db = $this->get_db();
+ $factory = new \phpbb\db\tools\factory();
+ $db_tools = $factory->get($this->db);
+
+ $container = new phpbb_mock_container_builder();
+ $migrator = new \phpbb\db\migrator(
+ $container,
+ $config,
+ $db,
+ $db_tools,
+ self::$config['table_prefix'] . 'migrations',
+ $phpbb_root_path,
+ $phpEx,
+ self::$config['table_prefix'],
+ phpbb_database_test_case::get_core_tables(),
+ array(),
+ new \phpbb\db\migration\helper()
+ );
+ $container->set('migrator', $migrator);
+ $container->set('dispatcher', new phpbb_mock_event_dispatcher());
+ $user = new \phpbb\user('\phpbb\datetime');
+
+ $extension_manager = new \phpbb\extension\manager(
+ $container,
+ $db,
+ $config,
+ $user,
+ self::$config['table_prefix'] . 'ext',
+ dirname(__FILE__) . '/',
+ $phpEx,
+ $this->get_cache_driver()
+ );
+
+ return $extension_manager;
+ }
+
+ protected function get_db()
+ {
+ // so we don't reopen an open connection
+ if (!($this->db instanceof \phpbb\db\driver\driver_interface))
+ {
+ $dbms = self::$config['dbms'];
+ /** @var \phpbb\db\driver\driver_interface $db */
+ $db = new $dbms();
+ $db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']);
+ $this->db = $db;
+ }
+ return $this->db;
+ }
+
+ protected function logout()
+ {
+ $this->add_lang('ucp');
+
+ if (empty($this->sid))
+ {
+ return;
+ }
+
+ $this->visit('ucp.php?sid=' . $this->sid . '&mode=logout');
+ $this->assertContains($this->lang('REGISTER'), $this->getDriver()->getPageSource());
+ unset($this->sid);
+
+ }
+
+ /**
+ * Login to the ACP
+ * You must run login() before calling this.
+ */
+ protected function admin_login($username = 'admin')
+ {
+ $this->add_lang('acp/common');
+
+ // Requires login first!
+ if (empty($this->sid))
+ {
+ $this->fail('$this->sid is empty. Make sure you call login() before admin_login()');
+ return;
+ }
+
+ $this->getDriver()->manage()->deleteAllCookies();
+
+ $this->visit('adm/index.php?sid=' . $this->sid);
+ $this->assertContains($this->lang('LOGIN_ADMIN_CONFIRM'), $this->getDriver()->getPageSource());
+
+ $this->find_element('cssSelector', 'input[name=username]')->clear()->sendKeys($username);
+ $this->find_element('cssSelector', 'input[type=password]')->sendKeys($username . $username);
+ $this->find_element('cssSelector', 'input[name=login]')->click();
+ $this->assertContains($this->lang('ADMIN_PANEL'), $this->find_element('cssSelector', 'h1')->getText());
+
+ $cookies = $this->getDriver()->manage()->getCookies();
+
+ // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
+ foreach ($cookies as $cookie)
+ {
+ if (substr($cookie['name'], -4) == '_sid')
+ {
+ $this->sid = $cookie['value'];
+
+ break;
+ }
+ }
+
+ $this->assertNotEmpty($this->sid);
+ }
+
+ protected function add_lang($lang_file)
+ {
+ if (is_array($lang_file))
+ {
+ foreach ($lang_file as $file)
+ {
+ $this->add_lang($file);
+ }
+ }
+
+ $lang_path = __DIR__ . "/../../phpBB/language/en/$lang_file.php";
+
+ $lang = array();
+
+ if (file_exists($lang_path))
+ {
+ include($lang_path);
+ }
+
+ $this->lang = array_merge($this->lang, $lang);
+ }
+
+ protected function add_lang_ext($ext_name, $lang_file)
+ {
+ if (is_array($lang_file))
+ {
+ foreach ($lang_file as $file)
+ {
+ $this->add_lang_ext($ext_name, $file);
+ }
+
+ return;
+ }
+
+ $lang_path = __DIR__ . "/../../phpBB/ext/{$ext_name}/language/en/$lang_file.php";
+
+ $lang = array();
+
+ if (file_exists($lang_path))
+ {
+ include($lang_path);
+ }
+
+ $this->lang = array_merge($this->lang, $lang);
+ }
+
+ protected function lang()
+ {
+ $args = func_get_args();
+ $key = $args[0];
+
+ if (empty($this->lang[$key]))
+ {
+ throw new RuntimeException('Language key "' . $key . '" could not be found.');
+ }
+
+ $args[0] = $this->lang[$key];
+
+ return call_user_func_array('sprintf', $args);
+ }
+
+ /**
+ * assertContains for language strings
+ *
+ * @param string $needle Search string
+ * @param string $haystack Search this
+ * @param string $message Optional failure message
+ */
+ public function assertContainsLang($needle, $haystack, $message = null)
+ {
+ $this->assertContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message);
+ }
+
+ /**
+ * assertNotContains for language strings
+ *
+ * @param string $needle Search string
+ * @param string $haystack Search this
+ * @param string $message Optional failure message
+ */
+ public function assertNotContainsLang($needle, $haystack, $message = null)
+ {
+ $this->assertNotContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message);
+ }
+
+ protected function login($username = 'admin')
+ {
+ $this->add_lang('ucp');
+
+ $this->getDriver()->manage()->deleteAllCookies();
+
+ $this->visit('ucp.php');
+ $this->assertContains($this->lang('LOGIN_EXPLAIN_UCP'), $this->getDriver()->getPageSource());
+
+ $this->getDriver()->manage()->deleteAllCookies();
+
+ $this->find_element('cssSelector', 'input[name=username]')->sendKeys($username);
+ $this->find_element('cssSelector', 'input[name=password]')->sendKeys($username . $username);
+ $this->find_element('cssSelector', 'input[name=login]')->click();
+ $this->assertNotContains($this->lang('LOGIN'), $this->find_element('className', 'navbar')->getText());
+
+ $cookies = $this->getDriver()->manage()->getCookies();
+
+ // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
+ foreach ($cookies as $cookie)
+ {
+ if (substr($cookie['name'], -4) == '_sid')
+ {
+ $this->sid = $cookie['value'];
+ }
+ }
+
+ $this->assertNotEmpty($this->sid);
+ }
+
+ /**
+ * Take screenshot. Can be used for debug purposes.
+ *
+ * @throws Exception When screenshot can't be created
+ */
+ public function take_screenshot()
+ {
+ // Change the Path to your own settings
+ $screenshot = time() . ".png";
+
+ $this->getDriver()->takeScreenshot($screenshot);
+ }
+
+ /**
+ * Wait for AJAX. Should be called after an AJAX action is made.
+ *
+ * @param string $framework javascript frameworks jquery|prototype|dojo
+ * @throws \Facebook\WebDriver\Exception\NoSuchElementException
+ * @throws \Facebook\WebDriver\Exception\TimeOutException
+ */
+ public function waitForAjax($framework = 'jquery')
+ {
+ switch ($framework)
+ {
+ case 'jquery':
+ $code = 'return jQuery.active;';
+ break;
+ case 'prototype':
+ $code = 'return Ajax.activeRequestCount;';
+ break;
+ case 'dojo':
+ $code = 'return dojo.io.XMLHTTPTransport.inFlight.length;';
+ break;
+ default:
+ throw new \RuntimeException('Unsupported framework');
+ break;
+ }
+ // wait for at most 30s, retry every 2000ms (2s)
+ $driver = $this->getDriver();
+ $driver->wait(30, 2000)->until(
+ function () use ($driver, $code) {
+ return !$driver->executeScript($code);
+ }
+ );
+ }
+}
diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php
index d3be7d2fb4..f57bbdd6dc 100644
--- a/tests/text_formatter/s9e/factory_test.php
+++ b/tests/text_formatter/s9e/factory_test.php
@@ -15,7 +15,7 @@ require_once __DIR__ . '/../../test_framework/phpbb_database_test_case.php';
class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
$this->cache = new phpbb_mock_cache;
$this->dispatcher = new phpbb_mock_event_dispatcher;
diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php
index 805dd89039..0d902c9130 100644
--- a/tests/text_processing/decode_message_test.php
+++ b/tests/text_processing/decode_message_test.php
@@ -13,7 +13,7 @@
class phpbb_text_processing_decode_message_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php
index f7da27cc35..8429c16c3a 100644
--- a/tests/text_processing/generate_text_for_display_test.php
+++ b/tests/text_processing/generate_text_for_display_test.php
@@ -13,7 +13,7 @@
class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
global $cache, $user, $phpbb_dispatcher;
diff --git a/tests/text_processing/generate_text_for_storage_test.php b/tests/text_processing/generate_text_for_storage_test.php
index c6c62c7579..68320ec7d1 100644
--- a/tests/text_processing/generate_text_for_storage_test.php
+++ b/tests/text_processing/generate_text_for_storage_test.php
@@ -13,7 +13,7 @@
class phpbb_text_processing_generate_text_for_storage_test extends phpbb_test_case
{
- public function setUp(): void
+ protected function setUp(): void
{
global $config, $phpbb_container, $phpbb_dispatcher;
diff --git a/tests/text_reparser/base_test.php b/tests/text_reparser/base_test.php
index 59604da4e3..edf39e7f10 100644
--- a/tests/text_reparser/base_test.php
+++ b/tests/text_reparser/base_test.php
@@ -17,7 +17,7 @@ class phpbb_textreparser_base_test extends phpbb_database_test_case
{
protected $db;
- public function setUp(): void
+ protected function setUp(): void
{
global $config;
if (!isset($config))
diff --git a/tests/text_reparser/manager_test.php b/tests/text_reparser/manager_test.php
index afa557deff..a70e41dce7 100644
--- a/tests/text_reparser/manager_test.php
+++ b/tests/text_reparser/manager_test.php
@@ -30,7 +30,7 @@ class phpbb_text_reparser_manager_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config_text.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/text_reparser/plugins/contact_admin_info_test.php b/tests/text_reparser/plugins/contact_admin_info_test.php
index 690d3a4046..f8a925ccea 100644
--- a/tests/text_reparser/plugins/contact_admin_info_test.php
+++ b/tests/text_reparser/plugins/contact_admin_info_test.php
@@ -39,7 +39,7 @@ class phpbb_textreparser_contact_admin_info_test extends phpbb_database_test_cas
return $rows;
}
- public function setUp(): void
+ protected function setUp(): void
{
global $config;
if (!isset($config))
diff --git a/tests/text_reparser/plugins/poll_option_test.php b/tests/text_reparser/plugins/poll_option_test.php
index 32fb8a0411..b18cb07153 100644
--- a/tests/text_reparser/plugins/poll_option_test.php
+++ b/tests/text_reparser/plugins/poll_option_test.php
@@ -39,7 +39,7 @@ class phpbb_textreparser_poll_option_test extends phpbb_database_test_case
return $rows;
}
- public function setUp(): void
+ protected function setUp(): void
{
global $config;
if (!isset($config))
diff --git a/tests/text_reparser/plugins/test_row_based_plugin.php b/tests/text_reparser/plugins/test_row_based_plugin.php
index cf913c9c1e..700bead7e5 100644
--- a/tests/text_reparser/plugins/test_row_based_plugin.php
+++ b/tests/text_reparser/plugins/test_row_based_plugin.php
@@ -39,7 +39,7 @@ abstract class phpbb_textreparser_test_row_based_plugin extends phpbb_database_t
return $rows;
}
- public function setUp(): void
+ protected function setUp(): void
{
global $config;
if (!isset($config))
diff --git a/tests/tree/nestedset_forum_base.php b/tests/tree/nestedset_forum_base.php
index e91e816b2a..44d51f7100 100644
--- a/tests/tree/nestedset_forum_base.php
+++ b/tests/tree/nestedset_forum_base.php
@@ -48,7 +48,7 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case
$lock,
$db;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php
index 656b801372..c77a7ee401 100644
--- a/tests/upload/filespec_test.php
+++ b/tests/upload/filespec_test.php
@@ -15,7 +15,6 @@ class phpbb_filespec_test extends phpbb_test_case
{
const TEST_COUNT = 100;
const PREFIX = 'phpbb_';
- const MAX_STR_LEN = 50;
const UPLOAD_MAX_FILESIZE = 1000;
private $config;
@@ -28,6 +27,8 @@ class phpbb_filespec_test extends phpbb_test_case
/** @var string phpBB root path */
protected $phpbb_root_path;
+ protected $mimetype_guesser;
+
protected function setUp(): void
{
// Global $config required by unique_id
@@ -374,7 +375,7 @@ class phpbb_filespec_test extends phpbb_test_case
public function test_move_file($tmp_name, $realname, $mime_type, $extension, $error, $expected)
{
// Global $phpbb_root_path and $phpEx are required by phpbb_chmod
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path;
$this->phpbb_root_path = '';
$upload = new phpbb_mock_fileupload();
diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php
index ca9259d357..a5b897d180 100644
--- a/tests/upload/fileupload_test.php
+++ b/tests/upload/fileupload_test.php
@@ -17,6 +17,7 @@ class phpbb_fileupload_test extends phpbb_test_case
{
private $path;
+ /** @var \phpbb\filesystem\filesystem */
private $filesystem;
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
@@ -37,6 +38,8 @@ class phpbb_fileupload_test extends phpbb_test_case
/** @var string phpBB root path */
protected $phpbb_root_path;
+ protected $mimetype_guesser;
+
protected function setUp(): void
{
// Global $config required by unique_id
@@ -65,7 +68,7 @@ class phpbb_fileupload_test extends phpbb_test_case
$guessers[3]->set_priority(-2);
$this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers);
- $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
+ $this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -117,7 +120,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_invalid_extension()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -127,7 +130,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_disallowed_content()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
$file = new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path);
@@ -146,7 +149,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_invalid_filename()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -157,7 +160,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_too_large()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -168,7 +171,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_valid_file()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
$file = $this->gen_valid_filespec();
@@ -178,7 +181,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_local_upload()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -192,7 +195,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -206,7 +209,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file_overwrite()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -221,7 +224,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_valid_dimensions()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(false)
->set_max_filesize(false)
->set_allowed_dimensions(1, 1, 100, 100);
diff --git a/tests/upload/imagesize_test.php b/tests/upload/imagesize_test.php
index 3adf61dedc..654e32054a 100644
--- a/tests/upload/imagesize_test.php
+++ b/tests/upload/imagesize_test.php
@@ -20,7 +20,7 @@ class phpbb_upload_imagesize_test extends \phpbb_test_case
/** @var string Path to fixtures */
protected $path;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
$this->imagesize = new \FastImageSize\FastImageSize();
diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php
index f283e993dc..b22b3690ad 100644
--- a/tests/user/user_loader_test.php
+++ b/tests/user/user_loader_test.php
@@ -21,7 +21,7 @@ class phpbb_user_loader_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_loader.xml');
}
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/version/version_fetch_test.php b/tests/version/version_fetch_test.php
index 4e8e82567a..e9c5a22cf0 100644
--- a/tests/version/version_fetch_test.php
+++ b/tests/version/version_fetch_test.php
@@ -16,7 +16,9 @@
*/
class phpbb_version_helper_fetch_test extends phpbb_test_case
{
- public function setUp(): void
+ protected $cache, $version_helper;
+
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/version/version_helper_remote_test.php b/tests/version/version_helper_remote_test.php
index d392d6d256..7e0fbbbdb4 100644
--- a/tests/version/version_helper_remote_test.php
+++ b/tests/version/version_helper_remote_test.php
@@ -16,8 +16,9 @@ class version_helper_remote_test extends \phpbb_test_case
protected $file_downloader;
protected $cache;
protected $version_helper;
+ protected $user;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/version/version_test.php b/tests/version/version_test.php
index 3298213487..561367fd03 100644
--- a/tests/version/version_test.php
+++ b/tests/version/version_test.php
@@ -13,7 +13,10 @@
class phpbb_version_helper_test extends phpbb_test_case
{
- public function setUp(): void
+ protected $cache;
+ protected $version_helper;
+
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/viewonline/helper_test.php b/tests/viewonline/helper_test.php
index d7c9965ad1..83b343f602 100644
--- a/tests/viewonline/helper_test.php
+++ b/tests/viewonline/helper_test.php
@@ -13,11 +13,13 @@
class phpbb_viewonline_helper_test extends phpbb_test_case
{
- public function setUp(): void
+ protected $viewonline_helper;
+
+ protected function setUp(): void
{
parent::setUp();
- $this->viewonline_helper = new \phpbb\viewonline_helper(new \phpbb\filesystem\filesystem());
+ $this->viewonline_helper = new \phpbb\viewonline_helper();
}
public function session_pages_data()
diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php
index d6ce11219f..858cf473a3 100644
--- a/tests/wrapper/phpbb_php_ini_test.php
+++ b/tests/wrapper/phpbb_php_ini_test.php
@@ -18,7 +18,7 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case
/** @var \phpbb_php_ini_fake php_ini */
protected $php_ini;
- public function setUp(): void
+ protected function setUp(): void
{
$this->php_ini = new phpbb_php_ini_fake;
}