aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Calvo <rubencm@gmail.com>2017-10-23 17:02:05 +0200
committerRubén Calvo <rubencm@gmail.com>2018-05-16 23:27:56 +0200
commit01a8487244d924f3715e11742909318ae2a959c2 (patch)
treee50e9eeb749e0b0d92a702423def7c725743f547 /tests/files/types_remote_test.php
parent[ticket/15311] Use stream_copy_to_stream (diff)
downloadphpbb-01a8487244d924f3715e11742909318ae2a959c2.tar.gz
phpbb-01a8487244d924f3715e11742909318ae2a959c2.tar.bz2
phpbb-01a8487244d924f3715e11742909318ae2a959c2.zip
[ticket/15311] Use cache directory if can't use system temp
PHPBB3-15311
Diffstat (limited to 'tests/files/types_remote_test.php')
-rw-r--r--tests/files/types_remote_test.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php
index 85ec2a528b..29e831e87f 100644
--- a/tests/files/types_remote_test.php
+++ b/tests/files/types_remote_test.php
@@ -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);