diff options
Diffstat (limited to 'tests/mock')
| -rw-r--r-- | tests/mock/container_builder.php | 15 | ||||
| -rw-r--r-- | tests/mock/controller_helper.php | 14 | ||||
| -rw-r--r-- | tests/mock/extension_manager.php | 2 | ||||
| -rw-r--r-- | tests/mock/fileupload.php | 3 | ||||
| -rw-r--r-- | tests/mock/notification_manager.php | 7 | ||||
| -rw-r--r-- | tests/mock/notification_type_post.php | 6 | ||||
| -rw-r--r-- | tests/mock/router.php | 27 | 
7 files changed, 50 insertions, 24 deletions
| diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php index 297e3a65e6..134589b0b8 100644 --- a/tests/mock/container_builder.php +++ b/tests/mock/container_builder.php @@ -52,7 +52,15 @@ class phpbb_mock_container_builder implements ContainerInterface  	{  		if ($this->has($id))  		{ -			return $this->services[$id]; +			$service = $this->services[$id]; +			if (is_array($service) && is_callable($service[0])) +			{ +				return call_user_func_array($service[0], $service[1]); +			} +			else +			{ +				return $service; +			}  		}  		throw new Exception('Could not find service: ' . $id); @@ -180,4 +188,9 @@ class phpbb_mock_container_builder implements ContainerInterface  	public function isScopeActive($name)  	{  	} + +	public function isFrozen() +	{ +		return false; +	}  } diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php index ae3e7bf432..0116dced49 100644 --- a/tests/mock/controller_helper.php +++ b/tests/mock/controller_helper.php @@ -13,20 +13,6 @@  class phpbb_mock_controller_helper extends \phpbb\controller\helper  { -	public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, \phpbb\request\request_interface $request, \phpbb\filesystem $filesystem, $phpbb_root_path, $php_ext, $phpbb_root_path_ext) -	{ -		$this->template = $template; -		$this->user = $user; -		$this->config = $config; -		$this->symfony_request = $symfony_request; -		$this->request = $request; -		$this->filesystem = $filesystem; -		$this->phpbb_root_path = $phpbb_root_path; -		$this->php_ext = $php_ext; -		$provider->find_routing_files($manager->get_finder()); -		$this->route_collection = $provider->find($phpbb_root_path_ext)->get_routes(); -	} -  	public function get_current_url()  	{  		return ''; diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php index 3b759fbbc2..2ce61c5149 100644 --- a/tests/mock/extension_manager.php +++ b/tests/mock/extension_manager.php @@ -18,7 +18,7 @@ class phpbb_mock_extension_manager extends \phpbb\extension\manager  		$this->phpbb_root_path = $phpbb_root_path;  		$this->php_ext = 'php';  		$this->extensions = $extensions; -		$this->filesystem = new \phpbb\filesystem(); +		$this->filesystem = new \phpbb\filesystem\filesystem();  		$this->container = $container;  	}  } diff --git a/tests/mock/fileupload.php b/tests/mock/fileupload.php index 8cc4d77ea1..5a0afc6cd3 100644 --- a/tests/mock/fileupload.php +++ b/tests/mock/fileupload.php @@ -19,9 +19,10 @@ class phpbb_mock_fileupload  {  	public $max_filesize = 100;  	public $error_prefix = ''; +	public $valid_dimensions = true;  	public function valid_dimensions($filespec)  	{ -		return true; +		return $this->valid_dimensions;  	}  } diff --git a/tests/mock/notification_manager.php b/tests/mock/notification_manager.php index 6a590bc0ca..952c0db489 100644 --- a/tests/mock/notification_manager.php +++ b/tests/mock/notification_manager.php @@ -32,19 +32,18 @@ class phpbb_mock_notification_manager  		);  	} -	public function mark_notifications_read() +	public function mark_notifications()  	{  	} -	public function mark_notifications_read_by_parent() +	public function mark_notifications_by_parent()  	{  	} -	public function mark_notifications_read_by_id() +	public function mark_notifications_by_id()  	{  	} -  	public function add_notifications()  	{  		return array(); diff --git a/tests/mock/notification_type_post.php b/tests/mock/notification_type_post.php index 6d8f6dc504..4116fecf5e 100644 --- a/tests/mock/notification_type_post.php +++ b/tests/mock/notification_type_post.php @@ -21,11 +21,12 @@ if (!defined('IN_PHPBB'))  class phpbb_mock_notification_type_post extends \phpbb\notification\type\post  { -	public function __construct($user_loader, $db, $cache, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) +	public function __construct($user_loader, $db, $cache, $language, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $user_notifications_table)  	{  		$this->user_loader = $user_loader;  		$this->db = $db;  		$this->cache = $cache; +		$this->language = $language;  		$this->user = $user;  		$this->auth = $auth;  		$this->config = $config; @@ -34,7 +35,6 @@ class phpbb_mock_notification_type_post extends \phpbb\notification\type\post  		$this->php_ext = $php_ext;  		$this->notification_types_table = $notification_types_table; -		$this->notifications_table = $notifications_table; -		$this->user_notifications_table = $user_notifications_table;	 +		$this->user_notifications_table = $user_notifications_table;  	}  } diff --git a/tests/mock/router.php b/tests/mock/router.php new file mode 100644 index 0000000000..01faa338c5 --- /dev/null +++ b/tests/mock/router.php @@ -0,0 +1,27 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_mock_router extends \phpbb\routing\router +{ +	public function get_matcher() +	{ +		$this->create_new_url_matcher(); +		return parent::get_matcher(); +	} + +	public function get_generator() +	{ +		$this->create_new_url_generator(); +		return parent::get_generator(); +	} +} | 
