diff options
Diffstat (limited to 'tests/mock')
-rw-r--r-- | tests/mock/cache.php | 8 | ||||
-rw-r--r-- | tests/mock/container_builder.php | 15 | ||||
-rw-r--r-- | tests/mock/fileupload.php | 5 | ||||
-rw-r--r-- | tests/mock/session_testable.php | 7 | ||||
-rw-r--r-- | tests/mock/user.php | 2 |
5 files changed, 28 insertions, 9 deletions
diff --git a/tests/mock/cache.php b/tests/mock/cache.php index 5fa3d28147..2306fd9009 100644 --- a/tests/mock/cache.php +++ b/tests/mock/cache.php @@ -72,13 +72,13 @@ class phpbb_mock_cache implements \phpbb\cache\driver\driver_interface } } - public function checkVar(PHPUnit_Framework_Assert $test, $var_name, $data) + public function checkVar(PHPUnit\Framework\Assert $test, $var_name, $data) { $test->assertTrue(isset($this->data[$var_name])); $test->assertEquals($data, $this->data[$var_name]); } - public function checkAssociativeVar(PHPUnit_Framework_Assert $test, $var_name, $data, $sort = true) + public function checkAssociativeVar(PHPUnit\Framework\Assert $test, $var_name, $data, $sort = true) { $test->assertTrue(isset($this->data[$var_name])); @@ -93,12 +93,12 @@ class phpbb_mock_cache implements \phpbb\cache\driver\driver_interface $test->assertEquals($data, $this->data[$var_name]); } - public function checkVarUnset(PHPUnit_Framework_Assert $test, $var_name) + public function checkVarUnset(PHPUnit\Framework\Assert $test, $var_name) { $test->assertFalse(isset($this->data[$var_name])); } - public function check(PHPUnit_Framework_Assert $test, $data, $ignore_db_info = true) + public function check(PHPUnit\Framework\Assert $test, $data, $ignore_db_info = true) { $cache_data = $this->data; diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php index 134589b0b8..17c4ae22dd 100644 --- a/tests/mock/container_builder.php +++ b/tests/mock/container_builder.php @@ -18,16 +18,22 @@ class phpbb_mock_container_builder implements ContainerInterface protected $services = array(); protected $parameters = array(); + public function __construct() + { + $this->setParameter('debug.load_time', false); + $this->setParameter('session.log_errors', false); + } + /** * Sets a service. * * @param string $id The service identifier * @param object $service The service instance - * @param string $scope The scope of the service + * @param bool $shared Whether service is shared * * @api */ - public function set($id, $service, $scope = self::SCOPE_CONTAINER) + public function set($id, $service, $shared = false) { $this->services[$id] = $service; } @@ -193,4 +199,9 @@ class phpbb_mock_container_builder implements ContainerInterface { return false; } + + public function initialized($id) + { + return true; + } } diff --git a/tests/mock/fileupload.php b/tests/mock/fileupload.php index 5a0afc6cd3..83c43d8af0 100644 --- a/tests/mock/fileupload.php +++ b/tests/mock/fileupload.php @@ -21,6 +21,11 @@ class phpbb_mock_fileupload public $error_prefix = ''; public $valid_dimensions = true; + public $min_width = 0; + public $min_height = 0; + public $max_width = 0; + public $max_height = 0; + public function valid_dimensions($filespec) { return $this->valid_dimensions; diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php index 2f24978ba8..fea5db6fb9 100644 --- a/tests/mock/session_testable.php +++ b/tests/mock/session_testable.php @@ -21,6 +21,7 @@ class phpbb_mock_session_testable extends \phpbb\session { private $_cookies = array(); + public $lang = []; public function set_cookie($name, $data, $time, $httponly = true) { @@ -30,14 +31,14 @@ class phpbb_mock_session_testable extends \phpbb\session /** * Checks if the cookies were set correctly. * - * @param PHPUnit_Framework_Assert test The test from which this is called + * @param PHPUnit\Framework\Assert test The test from which this is called * @param array(string => mixed) cookies The cookie data to check against. * The keys are cookie names, the values can either be null to - * check only the existance of the cookie, or an array(d, t), + * check only the existence of the cookie, or an array(d, t), * where d is the cookie data to check, or null to skip the * check and t is the cookie time to check, or null to skip. */ - public function check_cookies(PHPUnit_Framework_Assert $test, $cookies) + public function check_cookies(PHPUnit\Framework\Assert $test, $cookies) { $test->assertEquals(array_keys($cookies), array_keys($this->_cookies), 'Incorrect cookies were set'); diff --git a/tests/mock/user.php b/tests/mock/user.php index 9888337a9e..d9211369bc 100644 --- a/tests/mock/user.php +++ b/tests/mock/user.php @@ -21,6 +21,8 @@ class phpbb_mock_user { public $host = "testhost"; public $page = array('root_script_path' => '/'); + public $style = []; + public $data = []; private $options = array(); public function optionget($item) |