aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mock
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2012-07-08 23:10:42 +0200
committerNils Adermann <naderman@naderman.de>2012-07-08 23:10:42 +0200
commit527f02bb4b7e023c822fa2fe648784a77d7b9cc9 (patch)
tree10f7d21af120c6a8efb7b304e88cd6a1a2adddfe /tests/mock
parent576cd6dd1e45171e998d6aa13ab74b73939ce084 (diff)
parent088dbc0b54ab4798e2ec4c0466189f3d7e8256ed (diff)
downloadforums-527f02bb4b7e023c822fa2fe648784a77d7b9cc9.tar
forums-527f02bb4b7e023c822fa2fe648784a77d7b9cc9.tar.gz
forums-527f02bb4b7e023c822fa2fe648784a77d7b9cc9.tar.bz2
forums-527f02bb4b7e023c822fa2fe648784a77d7b9cc9.tar.xz
forums-527f02bb4b7e023c822fa2fe648784a77d7b9cc9.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/10974] Rename tests/mock_user.php -> tests/mock/user.php Conflicts: tests/bbcode/url_bbcode_test.php
Diffstat (limited to 'tests/mock')
-rw-r--r--tests/mock/user.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/mock/user.php b/tests/mock/user.php
new file mode 100644
index 0000000000..ec14ce430e
--- /dev/null
+++ b/tests/mock/user.php
@@ -0,0 +1,36 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* Mock user class.
+* This class is used when tests invoke phpBB code expecting to have a global
+* user object, to avoid instantiating the actual user object.
+* It has a minimum amount of functionality, just to make tests work.
+*/
+class phpbb_mock_user
+{
+ public $host = "testhost";
+ public $page = array('root_script_path' => '/');
+
+ private $options = array();
+ public function optionget($item)
+ {
+ if (!isset($this->options[$item]))
+ {
+ 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;
+ }
+}