aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mock_user.php16
-rw-r--r--tests/text_processing/censor_text_test.php2
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/mock_user.php b/tests/mock_user.php
index a6ff5f6628..5b89ea3e19 100644
--- a/tests/mock_user.php
+++ b/tests/mock_user.php
@@ -18,15 +18,19 @@ class phpbb_mock_user
public $host = "testhost";
public $page = array('root_script_path' => '/');
+ private $options = array();
public function optionget($item)
{
- switch ($item)
+ if (!isset($this->options[$item]))
{
- case 'viewcensors':
- return false;
-
- default:
- trigger_error('Option not found, add it to the mock user object.');
+ 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/text_processing/censor_text_test.php b/tests/text_processing/censor_text_test.php
index 6138d92e65..2843f0b20b 100644
--- a/tests/text_processing/censor_text_test.php
+++ b/tests/text_processing/censor_text_test.php
@@ -19,6 +19,8 @@ class phpbb_text_processing_censor_text_test extends phpbb_test_case
global $cache, $user;
$cache = new phpbb_mock_cache;
$user = new phpbb_mock_user;
+
+ $user->optionset('viewcensors', false);
return array(
array('', ''),