1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-14 04:34:07 +02:00

[ticket/15311] Move get_temp_dir to another service

PHPBB3-15311
This commit is contained in:
Rubén Calvo
2018-05-30 23:15:31 +02:00
parent d156bf3757
commit b43268e8fc
52 changed files with 160 additions and 130 deletions

View File

@@ -41,7 +41,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
$this->request = $this->createMock('\phpbb\request\request');
$this->filesystem = new \phpbb\filesystem\filesystem('');
$this->filesystem = new \phpbb\filesystem\filesystem();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;

View File

@@ -47,7 +47,7 @@ class phpbb_files_types_form_test extends phpbb_test_case
->method('file')
->willReturn(array());
$this->filesystem = new \phpbb\filesystem\filesystem('');
$this->filesystem = new \phpbb\filesystem\filesystem();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;

View File

@@ -47,7 +47,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
->method('file')
->willReturn(array());
$this->filesystem = new \phpbb\filesystem\filesystem('');
$this->filesystem = new \phpbb\filesystem\filesystem();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;

View File

@@ -21,6 +21,9 @@ class phpbb_files_types_remote_test extends phpbb_test_case
/** @var \phpbb\filesystem\filesystem */
private $filesystem;
/** @var \phpbb\filesystem\temp */
private $temp;
/** @var \phpbb\config\config */
protected $config;
@@ -52,7 +55,8 @@ class phpbb_files_types_remote_test extends phpbb_test_case
$this->request = $this->createMock('\phpbb\request\request');
$cache_path = $phpbb_root_path . 'cache/files';
$this->filesystem = new \phpbb\filesystem\filesystem($cache_path);
$this->filesystem = new \phpbb\filesystem\filesystem();
$this->temp = new \phpbb\filesystem\temp($this->filesystem, $cache_path);
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
@@ -74,7 +78,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->filesystem, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$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->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);
@@ -109,7 +113,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
$php_ini->expects($this->any())
->method('getString')
->willReturn($max_file_size);
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->filesystem, $this->language, $php_ini, $this->request, $this->phpbb_root_path);
$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->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);
@@ -121,7 +125,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->filesystem, $this->language, $this->php_ini, $this->request, $this->phpbb_root_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->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload);

View File

@@ -50,7 +50,7 @@ class phpbb_files_upload_test extends phpbb_test_case
$this->request = $this->createMock('\phpbb\request\request');
$this->filesystem = new \phpbb\filesystem\filesystem('');
$this->filesystem = new \phpbb\filesystem\filesystem();
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;