1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

Merge branch '3.3.x'

This commit is contained in:
Marc Alexander
2020-01-09 20:34:59 +01:00
21 changed files with 110 additions and 46 deletions

View File

@@ -304,11 +304,45 @@ abstract class phpbb_database_test_case extends TestCase
return new phpbb_database_test_connection_manager($config);
}
/** array_diff() does not corretly compare multidimensionsl arrays
* This solution used for that https://www.codeproject.com/Questions/780780/PHP-Finding-differences-in-two-multidimensional-ar
*/
function array_diff_assoc_recursive($array1, $array2)
{
$difference = array();
foreach ($array1 as $key => $value)
{
if (is_array($value))
{
if (!isset($array2[$key]))
{
$difference[$key] = $value;
}
else if (!is_array($array2[$key]))
{
$difference[$key] = $value;
}
else
{
$new_diff = $this->array_diff_assoc_recursive($value, $array2[$key]);
if (!empty($new_diff))
{
$difference[$key] = $new_diff;
}
}
}
else if (!isset($array2[$key]) || $array2[$key] != $value)
{
$difference[$key] = $value;
}
}
return $difference;
}
public function assert_array_content_equals($one, $two)
{
// http://stackoverflow.com/questions/3838288/phpunit-assert-two-arrays-are-equal-but-order-of-elements-not-important
// but one array_diff is not enough!
if (count(array_diff($one, $two)) || count(array_diff($two, $one)))
// one-way comparison is not enough!
if (count($this->array_diff_assoc_recursive($one, $two)) || count($this->array_diff_assoc_recursive($two, $one)))
{
// get a nice error message
$this->assertEquals($one, $two);

View File

@@ -709,7 +709,7 @@ class phpbb_functional_test_case extends phpbb_test_case
protected function remove_user_group($group_name, $usernames)
{
global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx;
global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $user, $phpbb_root_path, $phpEx;
$config = new \phpbb\config\config(array());
$config['coppa_enable'] = 0;
@@ -746,7 +746,7 @@ class phpbb_functional_test_case extends phpbb_test_case
protected function add_user_group($group_name, $usernames, $default = false, $leader = false)
{
global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx;
global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $user, $phpbb_root_path, $phpEx;
$config = new \phpbb\config\config(array());
$config['coppa_enable'] = 0;
@@ -868,6 +868,8 @@ class phpbb_functional_test_case extends phpbb_test_case
{
$this->add_lang($file);
}
return;
}
$lang_path = __DIR__ . "/../../phpBB/language/en/$lang_file.php";