[ticket/11700] Fix unit tests after develop merge

PHPBB3-11700
This commit is contained in:
Nils Adermann 2013-09-17 17:12:41 +02:00
parent f039a3308a
commit 9d8ac2b0ce
16 changed files with 34 additions and 32 deletions

View file

@ -48,7 +48,7 @@ if (!defined('PHPBB_INSTALLED'))
// Eliminate . and .. from the path
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
$phpbb_filesystem = new phpbb\filesystem(
new phpbb\symfony\request(
new phpbb\symfony_request(
new phpbb\request\request()
),
$phpbb_root_path,

View file

@ -1072,7 +1072,7 @@ function phpbb_clean_path($path)
}
$phpbb_filesystem = new phpbb\filesystem(
new phpbb\symfony\request(
new phpbb\symfony_request(
new phpbb\request\request()
),
$phpbb_root_path,

View file

@ -23,7 +23,7 @@ if (!defined('IN_PHPBB'))
*/
class filesystem
{
/** @var phpbb_symfony_request */
/** @var \phpbb\symfony_request */
protected $symfony_request;
/** @var string */
@ -41,11 +41,11 @@ class filesystem
/**
* 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 $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->phpbb_root_path = $phpbb_root_path;

View file

@ -7,6 +7,8 @@
*
*/
namespace phpbb;
use Symfony\Component\HttpFoundation\Request;
/**
@ -17,26 +19,26 @@ if (!defined('IN_PHPBB'))
exit;
}
class phpbb_symfony_request extends Request
class symfony_request extends Request
{
/**
* 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
$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);
};
$get_parameters = $phpbb_request->get_super_global(phpbb_request_interface::GET);
$post_parameters = $phpbb_request->get_super_global(phpbb_request_interface::POST);
$server_parameters = $phpbb_request->get_super_global(phpbb_request_interface::SERVER);
$files_parameters = $phpbb_request->get_super_global(phpbb_request_interface::FILES);
$cookie_parameters = $phpbb_request->get_super_global(phpbb_request_interface::COOKIE);
$get_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::GET);
$post_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::POST);
$server_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::SERVER);
$files_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::FILES);
$cookie_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::COOKIE);
array_walk_recursive($get_parameters, $sanitizer);
array_walk_recursive($post_parameters, $sanitizer);

View file

@ -21,7 +21,7 @@ class asset
{
protected $components = array();
/** @var phpbb_filesystem **/
/** @var \phpbb\filesystem **/
protected $phpbb_filesystem;
/**
@ -29,7 +29,7 @@ class asset
*
* @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;

View file

@ -50,7 +50,7 @@ class phpbb_controller_helper_url_test extends phpbb_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
$this->user = $this->getMock('\phpbb\user');
$phpbb_filesystem = new \phpbb\filesystem(
new \phpbb\symfony\request(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$phpbb_root_path,
@ -102,7 +102,7 @@ class phpbb_controller_helper_url_test extends phpbb_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
$this->user = $this->getMock('\phpbb\user');
$phpbb_filesystem = new \phpbb\filesystem(
new \phpbb\symfony\request(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$phpbb_root_path,

View file

@ -60,7 +60,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->db,
$this->config,
new phpbb\filesystem(
new phpbb\symfony\request(
new phpbb\symfony_request(
new phpbb_mock_request()
),
dirname(__FILE__) . '/../../phpBB/',

View file

@ -115,7 +115,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$db,
$config,
new \phpbb\filesystem(
new \phpbb\symfony\request(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$phpbb_root_path,

View file

@ -42,7 +42,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->template = new \phpbb\template\twig\twig(
new \phpbb\filesystem(
new \phpbb\symfony\request(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$this->phpbb_root_path,
@ -71,7 +71,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->db,
$this->config,
new \phpbb\filesystem(
new \phpbb\symfony\request(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$this->phpbb_root_path,

View file

@ -15,7 +15,7 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case
{
parent::setUp();
$this->filesystem = new \phpbb\filesystem(
new \phpbb\symfony\request(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
dirname(__FILE__) . './../../phpBB/',

View file

@ -18,8 +18,8 @@ class phpbb_filesystem_web_root_path_test extends phpbb_test_case
$this->set_phpbb_root_path();
$this->filesystem = new phpbb_filesystem(
new phpbb_symfony_request(
$this->filesystem = new \phpbb\filesystem(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$this->phpbb_root_path,

View file

@ -15,7 +15,7 @@ class phpbb_mock_extension_manager extends \phpbb\extension\manager
$this->php_ext = 'php';
$this->extensions = $extensions;
$this->filesystem = new \phpbb\filesystem(
new \phpbb\symfony\request(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$this->phpbb_root_path,

View file

@ -117,7 +117,7 @@ Zeta test event in all',
dirname(__FILE__) . "/datasets/$dataset/"
);
$phpbb_filesystem = new \phpbb\filesystem(
new \phpbb\symfony\request(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$phpbb_root_path,

View file

@ -63,8 +63,8 @@ class phpbb_template_template_test_case extends phpbb_test_case
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
$this->user = new \phpbb\user;
$phpbb_filesystem = new phpbb_filesystem(
new phpbb_symfony_request(
$phpbb_filesystem = new \phpbb\filesystem(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$phpbb_root_path,

View file

@ -18,8 +18,8 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
$this->phpbb_filesystem = new phpbb_filesystem(
new phpbb_symfony_request(
$this->phpbb_filesystem = new \phpbb\filesystem(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
$phpbb_root_path,

View file

@ -204,7 +204,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$db,
$config,
new phpbb\filesystem(
new phpbb\symfony\request(
new phpbb\symfony_request(
new phpbb_mock_request()
),
$phpbb_root_path,