[ticket/715] Resolve issues with portal and tests on PHP 8.0

B3P-715
This commit is contained in:
Marc Alexander
2021-09-04 11:09:52 +02:00
parent 9eb415b79c
commit ed54e3ef0c
30 changed files with 233 additions and 143 deletions

View File

@@ -9,10 +9,8 @@
namespace board3\portal\tests\mock;
class user extends \phpbb\user
class language extends \phpbb\language\language
{
public $lang = array();
public function set($data)
{
foreach ($data as $key => $column)
@@ -21,6 +19,18 @@ class user extends \phpbb\user
}
}
public function add_lang($component, $extension_name = null)
{
if (!$extension_name !== null)
{
$this->add_lang_ext($extension_name, $component);
}
else
{
parent::add_lang($component, $extension_name);
}
}
public function add_lang_ext($ext_name, $lang_set, $use_db = false, $use_help = false)
{
if ($ext_name != 'board3/portal')
@@ -39,7 +49,8 @@ class user extends \phpbb\user
if (file_exists(dirname(__FILE__) . '/../../language/en/' . $lang_set . '.php'))
{
include_once(dirname(__FILE__) . '/../../language/en/' . $lang_set . '.php');
$foo = dirname(__FILE__) . '/../../language/en/' . $lang_set . '.php';
include(dirname(__FILE__) . '/../../language/en/' . $lang_set . '.php');
if (isset($lang))
{
@@ -47,10 +58,4 @@ class user extends \phpbb\user
}
}
}
public function lang()
{
$args = func_get_args();
return $this->lang[$args[0]];
}
}

View File

@@ -64,6 +64,11 @@ class template
$this->test_case->assertSame($expected, $this->data[$row]);
}
public function assert_not_exist($row)
{
$this->test_case->assertArrayNotHasKey($row, $this->data);
}
public function delete_var($key)
{
unset($this->data[$key]);
@@ -71,6 +76,6 @@ class template
public function get_row($row)
{
return $this->data[$row];
return $this->data[$row] ?? null;
}
}