aboutsummaryrefslogtreecommitdiffstats
path: root/tests/upload/fileupload_test.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-06-02 15:29:32 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-09-09 08:27:53 +0200
commit52652ca1824e91ecfe7549167aebd92c314af678 (patch)
tree56f629c9070e635fefa6e09fed95b0868dd7acd5 /tests/upload/fileupload_test.php
parent47f8f2cc88bdcd40087c8e391be1d33d36a2d308 (diff)
downloadforums-52652ca1824e91ecfe7549167aebd92c314af678.tar
forums-52652ca1824e91ecfe7549167aebd92c314af678.tar.gz
forums-52652ca1824e91ecfe7549167aebd92c314af678.tar.bz2
forums-52652ca1824e91ecfe7549167aebd92c314af678.tar.xz
forums-52652ca1824e91ecfe7549167aebd92c314af678.zip
[ticket/13904] Remove phpbb_root_path global from upload class
PHPBB3-13904
Diffstat (limited to 'tests/upload/fileupload_test.php')
-rw-r--r--tests/upload/fileupload_test.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php
index deb4404585..0832f269cb 100644
--- a/tests/upload/fileupload_test.php
+++ b/tests/upload/fileupload_test.php
@@ -33,6 +33,9 @@ class phpbb_fileupload_test extends phpbb_test_case
/** @var \phpbb\request\request_interface */
protected $request;
+ /** @var string phpBB root path */
+ protected $phpbb_root_path;
+
protected function setUp()
{
// Global $config required by unique_id
@@ -61,6 +64,7 @@ class phpbb_fileupload_test extends phpbb_test_case
$this->factory = new \phpbb\files\factory($this->container);
$this->path = __DIR__ . '/fixture/';
+ $this->phpbb_root_path = $phpbb_root_path;
}
private function gen_valid_filespec()
@@ -85,7 +89,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_invalid_extension()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('png'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -95,7 +99,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_invalid_filename()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -106,7 +110,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_too_large()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -117,7 +121,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_valid_file()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
$file = $this->gen_valid_filespec();
@@ -127,7 +131,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_local_upload()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -139,7 +143,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -153,7 +157,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file_overwrite()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -168,7 +172,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_valid_dimensions()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path);
$upload->set_allowed_extensions(false)
->set_max_filesize(false)
->set_allowed_dimensions(1, 1, 100, 100);