aboutsummaryrefslogtreecommitdiffstats
path: root/tests/template
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template')
-rw-r--r--tests/template/template_allfolder_test.php5
-rw-r--r--tests/template/template_test_case.php22
2 files changed, 24 insertions, 3 deletions
diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php
index f739a78d84..63f35bc758 100644
--- a/tests/template/template_allfolder_test.php
+++ b/tests/template/template_allfolder_test.php
@@ -28,7 +28,10 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
- $this->user = new \phpbb\user('\phpbb\datetime');
+ $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');
+ $this->user = $user;
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php
index 29ff669efc..7e2020ba09 100644
--- a/tests/template/template_test_case.php
+++ b/tests/template/template_test_case.php
@@ -15,6 +15,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_template_template_test_case extends phpbb_test_case
{
+ protected $lang;
protected $template;
protected $template_path;
protected $user;
@@ -24,6 +25,17 @@ class phpbb_template_template_test_case extends phpbb_test_case
// Keep the contents of the cache for debugging?
const PRESERVE_CACHE = true;
+ static protected $language_reflection_lang;
+
+ static public function setUpBeforeClass()
+ {
+ parent::setUpBeforeClass();
+
+ $reflection = new ReflectionClass('\phpbb\language\language');
+ self::$language_reflection_lang = $reflection->getProperty('lang');
+ self::$language_reflection_lang->setAccessible(true);
+ }
+
protected function display($handle)
{
ob_start();
@@ -65,7 +77,10 @@ class phpbb_template_template_test_case extends phpbb_test_case
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
- $this->user = new \phpbb\user('\phpbb\datetime');
+ $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
+ $this->lang = $lang = new \phpbb\language\language($lang_loader);
+ $user = new \phpbb\user($lang, '\phpbb\datetime');
+ $this->user = $user;
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
@@ -145,7 +160,10 @@ class phpbb_template_template_test_case extends phpbb_test_case
{
foreach ($lang_vars as $name => $value)
{
- $this->user->lang[$name] = $value;
+ self::$language_reflection_lang->setValue($this->lang, array_merge(
+ self::$language_reflection_lang->getValue($this->lang),
+ array($name => $value)
+ ));
}
}