blob: ec14ce430eebeb05c6ead3c97278ae87213529e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}
}
|