mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
[ticket/13904] Pass request service to upload instead of using global
PHPBB3-13904
This commit is contained in:
@@ -25,6 +25,9 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
||||
/** @var \phpbb\language\language */
|
||||
protected $language;
|
||||
|
||||
/** @var \phpbb\request\request_interface */
|
||||
protected $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
@@ -44,6 +47,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
||||
|
||||
$this->filesystem = new \phpbb\filesystem\filesystem();
|
||||
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
$this->request = $this->getMock('\phpbb\request\request');
|
||||
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$container->set('files.filespec', new \phpbb\files\filespec($this->filesystem, $this->language));
|
||||
@@ -61,7 +65,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
||||
public function test_invalid_extension()
|
||||
{
|
||||
/** @var \phpbb\files\upload $upload */
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
|
||||
$upload->set_error_prefix('')
|
||||
->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
@@ -72,7 +76,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
||||
public function test_empty_file()
|
||||
{
|
||||
/** @var \phpbb\files\upload $upload */
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
|
||||
$upload->set_error_prefix('')
|
||||
->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
@@ -83,7 +87,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
||||
public function test_successful_upload()
|
||||
{
|
||||
/** @var \phpbb\files\upload $upload */
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
|
||||
$upload->set_error_prefix('')
|
||||
->set_allowed_extensions(array('gif'))
|
||||
->set_max_filesize(1000);
|
||||
@@ -95,7 +99,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
||||
public function test_too_large()
|
||||
{
|
||||
/** @var \phpbb\files\upload $upload */
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
|
||||
$upload->set_error_prefix('')
|
||||
->set_allowed_extensions(array('gif'))
|
||||
->set_max_filesize(100);
|
||||
|
Reference in New Issue
Block a user