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

[ticket/15311] Use cache directory if can't use system temp

PHPBB3-15311
This commit is contained in:
Rubén Calvo
2017-10-23 17:02:05 +02:00
parent e8a70dcb24
commit 01a8487244
46 changed files with 145 additions and 57 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

@@ -15,8 +15,10 @@ require_once dirname(__FILE__) . '/type_foo.php';
class phpbb_files_types_remote_test extends phpbb_test_case
{
/** @var string */
private $path;
/** @var \phpbb\filesystem\filesystem */
private $filesystem;
/** @var \phpbb\config\config */
@@ -49,7 +51,8 @@ class phpbb_files_types_remote_test extends phpbb_test_case
$this->config->set('remote_upload_verify', 0);
$this->request = $this->createMock('\phpbb\request\request');
$this->filesystem = new \phpbb\filesystem\filesystem();
$cache_path = $phpbb_root_path . 'cache/files';
$this->filesystem = new \phpbb\filesystem\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;
@@ -71,7 +74,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->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->filesystem, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$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);
@@ -106,7 +109,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->language, $php_ini, $this->request, $this->phpbb_root_path);
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->filesystem, $this->language, $php_ini, $this->request, $this->phpbb_root_path);
$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);
@@ -118,7 +121,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->language, $this->php_ini, $this->request, $this->phpbb_root_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);
$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;