1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-26 09:44:26 +02:00

[ticket/16346] Fix method arguments

PHPBB3-16346
This commit is contained in:
rubencm
2020-08-14 18:42:50 +00:00
parent 758c28ca69
commit 490ddbc2cd
46 changed files with 78 additions and 144 deletions

View File

@@ -41,7 +41,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,

View File

@@ -50,7 +50,7 @@ class phpbb_files_types_form_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -158,7 +158,7 @@ class phpbb_files_types_form_test extends phpbb_test_case
->willReturn($plupload);
$type_form = new \phpbb\files\types\form($this->factory, $this->language, $this->php_ini, $this->plupload, $this->request);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_form->set_upload($upload);

View File

@@ -50,7 +50,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -147,7 +147,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
$this->factory = new \phpbb\files\factory($this->container);
$type_local = new \phpbb\files\types\local($this->factory, $this->language, $this->php_ini, $this->request);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_local->set_upload($upload);

View File

@@ -57,7 +57,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -75,7 +75,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
public function test_upload_fsock_fail()
{
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $this->php_ini, $this->request);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);
@@ -110,7 +110,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
->method('getString')
->willReturn($max_file_size);
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $php_ini, $this->request);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);
@@ -122,7 +122,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
public function test_upload_wrong_path()
{
$type_remote = new \phpbb\files\types\foo($this->config, $this->factory, $this->temp, $this->language, $this->php_ini, $this->request);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);
$type_remote::$tempnam_path = $this->phpbb_root_path . 'cache/wrong/path';

View File

@@ -31,9 +31,6 @@ class phpbb_files_upload_test extends phpbb_test_case
/** @var \phpbb\request\request_interface */
protected $request;
/** @var string phpBB root path */
protected $phpbb_root_path;
protected function setUp(): void
{
// Global $config required by unique_id
@@ -53,7 +50,7 @@ class phpbb_files_upload_test extends phpbb_test_case
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container = new phpbb_mock_container_builder();
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
$this->language,
@@ -64,13 +61,11 @@ class phpbb_files_upload_test extends phpbb_test_case
'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(),
))));
$this->factory = new \phpbb\files\factory($this->container);
$this->phpbb_root_path = $phpbb_root_path;
}
public function test_reset_vars()
{
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$upload->set_max_filesize(500);
$this->assertEquals(500, $upload->max_filesize);
$upload->reset_vars();
@@ -79,7 +74,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_set_disallowed_content()
{
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$disallowed_content = new ReflectionProperty($upload, 'disallowed_content');
$disallowed_content->setAccessible(true);
@@ -97,7 +92,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_is_valid()
{
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$this->assertFalse($upload->is_valid('foobar'));
}
@@ -120,7 +115,7 @@ class phpbb_files_upload_test extends phpbb_test_case
*/
public function test_assign_internal_error($error_code, $expected)
{
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
$this->assertSame($expected, $upload->assign_internal_error($error_code));
}
}