mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/11700] Fix unit tests after develop merge
PHPBB3-11700
This commit is contained in:
parent
f039a3308a
commit
9d8ac2b0ce
16 changed files with 34 additions and 32 deletions
|
@ -48,7 +48,7 @@ if (!defined('PHPBB_INSTALLED'))
|
||||||
// Eliminate . and .. from the path
|
// Eliminate . and .. from the path
|
||||||
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
|
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
|
||||||
$phpbb_filesystem = new phpbb\filesystem(
|
$phpbb_filesystem = new phpbb\filesystem(
|
||||||
new phpbb\symfony\request(
|
new phpbb\symfony_request(
|
||||||
new phpbb\request\request()
|
new phpbb\request\request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
|
|
@ -1072,7 +1072,7 @@ function phpbb_clean_path($path)
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpbb_filesystem = new phpbb\filesystem(
|
$phpbb_filesystem = new phpbb\filesystem(
|
||||||
new phpbb\symfony\request(
|
new phpbb\symfony_request(
|
||||||
new phpbb\request\request()
|
new phpbb\request\request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
|
|
@ -23,7 +23,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
class filesystem
|
class filesystem
|
||||||
{
|
{
|
||||||
/** @var phpbb_symfony_request */
|
/** @var \phpbb\symfony_request */
|
||||||
protected $symfony_request;
|
protected $symfony_request;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
|
@ -41,11 +41,11 @@ class filesystem
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_symfony_request $symfony_request
|
* @param \phpbb\symfony_request $symfony_request
|
||||||
* @param string $phpbb_root_path Relative path to phpBB root
|
* @param string $phpbb_root_path Relative path to phpBB root
|
||||||
* @param string $php_ext PHP extension (php)
|
* @param string $php_ext PHP extension (php)
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_symfony_request $symfony_request, $phpbb_root_path, $php_ext, $adm_relative_path = null)
|
public function __construct(\phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext, $adm_relative_path = null)
|
||||||
{
|
{
|
||||||
$this->symfony_request = $symfony_request;
|
$this->symfony_request = $symfony_request;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,26 +19,26 @@ if (!defined('IN_PHPBB'))
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
class phpbb_symfony_request extends Request
|
class symfony_request extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_request_interface $phpbb_request
|
* @param phpbb\request\request_interface $phpbb_request
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_request_interface $phpbb_request)
|
public function __construct(\phpbb\request\request_interface $phpbb_request)
|
||||||
{
|
{
|
||||||
// This function is meant to sanitize the global input arrays
|
// This function is meant to sanitize the global input arrays
|
||||||
$sanitizer = function(&$value, $key) {
|
$sanitizer = function(&$value, $key) {
|
||||||
$type_cast_helper = new phpbb_request_type_cast_helper();
|
$type_cast_helper = new \phpbb\request\type_cast_helper();
|
||||||
$type_cast_helper->set_var($value, $value, gettype($value), true);
|
$type_cast_helper->set_var($value, $value, gettype($value), true);
|
||||||
};
|
};
|
||||||
|
|
||||||
$get_parameters = $phpbb_request->get_super_global(phpbb_request_interface::GET);
|
$get_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::GET);
|
||||||
$post_parameters = $phpbb_request->get_super_global(phpbb_request_interface::POST);
|
$post_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::POST);
|
||||||
$server_parameters = $phpbb_request->get_super_global(phpbb_request_interface::SERVER);
|
$server_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::SERVER);
|
||||||
$files_parameters = $phpbb_request->get_super_global(phpbb_request_interface::FILES);
|
$files_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::FILES);
|
||||||
$cookie_parameters = $phpbb_request->get_super_global(phpbb_request_interface::COOKIE);
|
$cookie_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::COOKIE);
|
||||||
|
|
||||||
array_walk_recursive($get_parameters, $sanitizer);
|
array_walk_recursive($get_parameters, $sanitizer);
|
||||||
array_walk_recursive($post_parameters, $sanitizer);
|
array_walk_recursive($post_parameters, $sanitizer);
|
||||||
|
|
|
@ -21,7 +21,7 @@ class asset
|
||||||
{
|
{
|
||||||
protected $components = array();
|
protected $components = array();
|
||||||
|
|
||||||
/** @var phpbb_filesystem **/
|
/** @var \phpbb\filesystem **/
|
||||||
protected $phpbb_filesystem;
|
protected $phpbb_filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ class asset
|
||||||
*
|
*
|
||||||
* @param string $url URL
|
* @param string $url URL
|
||||||
*/
|
*/
|
||||||
public function __construct($url, phpbb_filesystem $phpbb_filesystem)
|
public function __construct($url, \phpbb\filesystem $phpbb_filesystem)
|
||||||
{
|
{
|
||||||
$this->phpbb_filesystem = $phpbb_filesystem;
|
$this->phpbb_filesystem = $phpbb_filesystem;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class phpbb_controller_helper_url_test extends phpbb_test_case
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
||||||
$this->user = $this->getMock('\phpbb\user');
|
$this->user = $this->getMock('\phpbb\user');
|
||||||
$phpbb_filesystem = new \phpbb\filesystem(
|
$phpbb_filesystem = new \phpbb\filesystem(
|
||||||
new \phpbb\symfony\request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
@ -102,7 +102,7 @@ class phpbb_controller_helper_url_test extends phpbb_test_case
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
||||||
$this->user = $this->getMock('\phpbb\user');
|
$this->user = $this->getMock('\phpbb\user');
|
||||||
$phpbb_filesystem = new \phpbb\filesystem(
|
$phpbb_filesystem = new \phpbb\filesystem(
|
||||||
new \phpbb\symfony\request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
|
|
@ -60,7 +60,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->config,
|
$this->config,
|
||||||
new phpbb\filesystem(
|
new phpbb\filesystem(
|
||||||
new phpbb\symfony\request(
|
new phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
dirname(__FILE__) . '/../../phpBB/',
|
dirname(__FILE__) . '/../../phpBB/',
|
||||||
|
|
|
@ -115,7 +115,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
|
||||||
$db,
|
$db,
|
||||||
$config,
|
$config,
|
||||||
new \phpbb\filesystem(
|
new \phpbb\filesystem(
|
||||||
new \phpbb\symfony\request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
|
|
@ -42,7 +42,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||||
|
|
||||||
$this->template = new \phpbb\template\twig\twig(
|
$this->template = new \phpbb\template\twig\twig(
|
||||||
new \phpbb\filesystem(
|
new \phpbb\filesystem(
|
||||||
new \phpbb\symfony\request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$this->phpbb_root_path,
|
$this->phpbb_root_path,
|
||||||
|
@ -71,7 +71,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\filesystem(
|
new \phpbb\filesystem(
|
||||||
new \phpbb\symfony\request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$this->phpbb_root_path,
|
$this->phpbb_root_path,
|
||||||
|
|
|
@ -15,7 +15,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->filesystem = new \phpbb\filesystem(
|
$this->filesystem = new \phpbb\filesystem(
|
||||||
new \phpbb\symfony\request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
dirname(__FILE__) . './../../phpBB/',
|
dirname(__FILE__) . './../../phpBB/',
|
||||||
|
|
|
@ -18,8 +18,8 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case
|
||||||
|
|
||||||
$this->set_phpbb_root_path();
|
$this->set_phpbb_root_path();
|
||||||
|
|
||||||
$this->filesystem = new phpbb_filesystem(
|
$this->filesystem = new \phpbb\filesystem(
|
||||||
new phpbb_symfony_request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$this->phpbb_root_path,
|
$this->phpbb_root_path,
|
||||||
|
|
|
@ -15,7 +15,7 @@ class phpbb_mock_extension_manager extends \phpbb\extension\manager
|
||||||
$this->php_ext = 'php';
|
$this->php_ext = 'php';
|
||||||
$this->extensions = $extensions;
|
$this->extensions = $extensions;
|
||||||
$this->filesystem = new \phpbb\filesystem(
|
$this->filesystem = new \phpbb\filesystem(
|
||||||
new \phpbb\symfony\request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$this->phpbb_root_path,
|
$this->phpbb_root_path,
|
||||||
|
|
|
@ -117,7 +117,7 @@ Zeta test event in all',
|
||||||
dirname(__FILE__) . "/datasets/$dataset/"
|
dirname(__FILE__) . "/datasets/$dataset/"
|
||||||
);
|
);
|
||||||
$phpbb_filesystem = new \phpbb\filesystem(
|
$phpbb_filesystem = new \phpbb\filesystem(
|
||||||
new \phpbb\symfony\request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
|
|
@ -63,8 +63,8 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
|
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
|
||||||
$this->user = new \phpbb\user;
|
$this->user = new \phpbb\user;
|
||||||
|
|
||||||
$phpbb_filesystem = new phpbb_filesystem(
|
$phpbb_filesystem = new \phpbb\filesystem(
|
||||||
new phpbb_symfony_request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
|
|
@ -18,8 +18,8 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
|
||||||
$defaults = $this->config_defaults();
|
$defaults = $this->config_defaults();
|
||||||
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
|
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
|
||||||
|
|
||||||
$this->phpbb_filesystem = new phpbb_filesystem(
|
$this->phpbb_filesystem = new \phpbb\filesystem(
|
||||||
new phpbb_symfony_request(
|
new \phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
|
|
@ -204,7 +204,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
$db,
|
$db,
|
||||||
$config,
|
$config,
|
||||||
new phpbb\filesystem(
|
new phpbb\filesystem(
|
||||||
new phpbb\symfony\request(
|
new phpbb\symfony_request(
|
||||||
new phpbb_mock_request()
|
new phpbb_mock_request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
|
|
Loading…
Add table
Reference in a new issue