aboutsummaryrefslogtreecommitdiffstats
path: root/tests/files
diff options
context:
space:
mode:
authorTristan Darricau <tristan.darricau@sensiolabs.com>2016-02-11 22:16:10 +0100
committerTristan Darricau <tristan.darricau@sensiolabs.com>2016-02-11 22:16:10 +0100
commitc9e5d308f2ebaae5ddaa70faf25af93fe2eb368b (patch)
treed1a901b18261466f47a5db5cc1cf9362a9974a1f /tests/files
parentaa6dd6d4ff28f38f9596b7bb3adf19a8a7988b67 (diff)
parent8cf086ef9b200f0b59348c0f0d4946f9ebc4adae (diff)
downloadforums-c9e5d308f2ebaae5ddaa70faf25af93fe2eb368b.tar
forums-c9e5d308f2ebaae5ddaa70faf25af93fe2eb368b.tar.gz
forums-c9e5d308f2ebaae5ddaa70faf25af93fe2eb368b.tar.bz2
forums-c9e5d308f2ebaae5ddaa70faf25af93fe2eb368b.tar.xz
forums-c9e5d308f2ebaae5ddaa70faf25af93fe2eb368b.zip
Merge pull request #4159 from marc1706/ticket/14448
[ticket/14448] Use guzzle for remote files uploading * marc1706/ticket/14448: [ticket/14448] Correctly pass verify setting if available [ticket/14448] Let user decide if remote upload certs should be checked [ticket/14448] Add new vendor files and dirs to clean task [ticket/14448] Do not try to test remote upload timeout [ticket/14448] Remove no longer needed guzzle 3.9.3 [ticket/14448] Use GuzzleHttp and try to verify certs [ticket/14448] Update composer.json and lock file for guzzlehttp [ticket/14431] Remote avatar uploading [ticket/14431] Remote avatar uploading
Diffstat (limited to 'tests/files')
-rw-r--r--tests/files/types_remote_test.php24
1 files changed, 8 insertions, 16 deletions
diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php
index caed5c9e05..476d8ed3ba 100644
--- a/tests/files/types_remote_test.php
+++ b/tests/files/types_remote_test.php
@@ -20,6 +20,9 @@ class phpbb_files_types_remote_test extends phpbb_test_case
private $filesystem;
+ /** @var \phpbb\config\config */
+ protected $config;
+
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
protected $container;
@@ -43,6 +46,8 @@ class phpbb_files_types_remote_test extends phpbb_test_case
global $config, $phpbb_root_path, $phpEx;
$config = new \phpbb\config\config(array());
+ $this->config = $config;
+ $this->config->set('remote_upload_verify', 0);
$this->request = $this->getMock('\phpbb\request\request');
$this->filesystem = new \phpbb\filesystem\filesystem();
@@ -67,7 +72,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->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
+ $type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $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);
@@ -102,7 +107,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->factory, $this->language, $php_ini, $this->request, $this->phpbb_root_path);
+ $type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $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);
@@ -112,22 +117,9 @@ class phpbb_files_types_remote_test extends phpbb_test_case
$this->assertSame($expected, $file->error);
}
- public function test_upload_timeout()
- {
- $type_remote = new \phpbb\files\types\remote($this->factory, $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);
- $upload->upload_timeout = -5;
-
- $file = $type_remote->upload('http://google.com/?.png');
-
- $this->assertSame(array('REMOTE_UPLOAD_TIMEOUT'), $file->error);
- }
-
public function test_upload_wrong_path()
{
- $type_remote = new \phpbb\files\types\foo($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->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);