aboutsummaryrefslogtreecommitdiffstats
path: root/tests/upload/fileupload_test.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-06-02 13:42:58 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-09-09 08:27:50 +0200
commitef59e0228a993bcaf7bf59c7cb24511f3cbe1b78 (patch)
treebfd8d38241257f85a9cd048fc7676b18cd052903 /tests/upload/fileupload_test.php
parent0121e60cd73963043047e1b29b8d94ea9aa684e3 (diff)
downloadforums-ef59e0228a993bcaf7bf59c7cb24511f3cbe1b78.tar
forums-ef59e0228a993bcaf7bf59c7cb24511f3cbe1b78.tar.gz
forums-ef59e0228a993bcaf7bf59c7cb24511f3cbe1b78.tar.bz2
forums-ef59e0228a993bcaf7bf59c7cb24511f3cbe1b78.tar.xz
forums-ef59e0228a993bcaf7bf59c7cb24511f3cbe1b78.zip
[ticket/13904] Fix tests again
PHPBB3-13904
Diffstat (limited to 'tests/upload/fileupload_test.php')
-rw-r--r--tests/upload/fileupload_test.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php
index 8b7056e9cf..87e10ac954 100644
--- a/tests/upload/fileupload_test.php
+++ b/tests/upload/fileupload_test.php
@@ -27,12 +27,15 @@ class phpbb_fileupload_test extends phpbb_test_case
/** @var \phpbb\files\factory */
protected $factory;
+ /** @var \phpbb\language\language */
+ protected $language;
+
protected function setUp()
{
// Global $config required by unique_id
// Global $user required by several functions dealing with translations
// Global $request required by form_upload, local_upload and is_valid
- global $config, $user, $request, $phpbb_filesystem, $phpbb_container;
+ global $config, $user, $request, $phpbb_filesystem, $phpbb_root_path, $phpEx;
if (!is_array($config))
{
@@ -49,7 +52,7 @@ class phpbb_fileupload_test extends phpbb_test_case
$this->filesystem = $phpbb_filesystem = new \phpbb\filesystem\filesystem();
- $this->container = new phpbb_mock_container_builder($this->phpbb_root_path, $this->phpEx);
+ $this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
$this->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem,
new \phpbb\mimetype\guesser(array(
@@ -57,6 +60,8 @@ class phpbb_fileupload_test extends phpbb_test_case
))));
$this->factory = new \phpbb\files\factory($this->container);
+ $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
+
$this->path = __DIR__ . '/fixture/';
}
@@ -82,7 +87,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);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
$upload->set_allowed_extensions(array('png'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -92,7 +97,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);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -103,7 +108,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);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100);
$file = $this->gen_valid_filespec();
@@ -114,7 +119,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);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
$file = $this->gen_valid_filespec();
@@ -124,7 +129,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_local_upload()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -136,7 +141,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -150,7 +155,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);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
$upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000);
@@ -165,7 +170,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_valid_dimensions()
{
- $upload = new \phpbb\files\upload($this->filesystem, $this->factory);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language);
$upload->set_allowed_extensions(false)
->set_max_filesize(false)
->set_allowed_dimensions(1, 1, 100, 100);