diff options
author | Callum Macrae <callum@lynxphp.com> | 2011-08-23 12:21:20 +0100 |
---|---|---|
committer | Callum Macrae <callum@lynxphp.com> | 2011-08-23 13:28:42 +0100 |
commit | 03da3c7c4c2d3957b738485935386723c536671b (patch) | |
tree | 3a149d607ea0620844c89d5352f102f224181752 /tests/mock_user.php | |
parent | d4f1b92479aeaab313d18c172e5e2fede7035281 (diff) | |
download | forums-03da3c7c4c2d3957b738485935386723c536671b.tar forums-03da3c7c4c2d3957b738485935386723c536671b.tar.gz forums-03da3c7c4c2d3957b738485935386723c536671b.tar.bz2 forums-03da3c7c4c2d3957b738485935386723c536671b.tar.xz forums-03da3c7c4c2d3957b738485935386723c536671b.zip |
[ticket/10240] Added optionset to mock_user in the tests.
Also made optionset use the value set by optionset. We're not checking
whether the option is set or not, because we would just throw an error
if it wasn't set, and it throws an error anyway.
PHPBB3-10240
Diffstat (limited to 'tests/mock_user.php')
-rw-r--r-- | tests/mock_user.php | 16 |
1 files changed, 10 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; } } |