aboutsummaryrefslogtreecommitdiffstats
path: root/tests/attachment
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-10-03 20:10:13 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-10-09 10:18:40 +0200
commit6c80fd92c6ab4aebb5701e6b1a46c46208d793c9 (patch)
treecd9cdcb8868d9905812be79ee2979569045ef631 /tests/attachment
parent8a6224bf8ad37ff5c739137dbbe4264e4328910e (diff)
downloadforums-6c80fd92c6ab4aebb5701e6b1a46c46208d793c9.tar
forums-6c80fd92c6ab4aebb5701e6b1a46c46208d793c9.tar.gz
forums-6c80fd92c6ab4aebb5701e6b1a46c46208d793c9.tar.bz2
forums-6c80fd92c6ab4aebb5701e6b1a46c46208d793c9.tar.xz
forums-6c80fd92c6ab4aebb5701e6b1a46c46208d793c9.zip
[ticket/14168] Add tests for init_error() during upload
PHPBB3-14168
Diffstat (limited to 'tests/attachment')
-rw-r--r--tests/attachment/upload_test.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php
index 2c08b5b72a..03d688cc1f 100644
--- a/tests/attachment/upload_test.php
+++ b/tests/attachment/upload_test.php
@@ -180,4 +180,53 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->assertSame($expected, $filedata);
}
+
+ public function test_init_error()
+ {
+ $filespec = $this->getMockBuilder('\phpbb\files\filespec')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $filespec->expects($this->any())
+ ->method('init_error')
+ ->willReturn(true);
+ $filespec->expects($this->any())
+ ->method('set_upload_namespace')
+ ->willReturnSelf();
+ $filespec->expects($this->any())
+ ->method('set_upload_ary')
+ ->willReturnSelf();
+ $this->container->set('files.filespec', $filespec);
+ $factory_mock = $this->getMockBuilder('\phpbb\files\factory')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $factory_mock->expects($this->any())
+ ->method('get')
+ ->willReturn($filespec);
+ $this->container->set('files.types.local', new \phpbb\files\types\local(
+ $factory_mock,
+ $this->language,
+ $this->php_ini,
+ $this->request
+ ));
+
+ $this->upload = new \phpbb\attachment\upload(
+ $this->auth,
+ $this->cache,
+ $this->config,
+ $this->files_upload,
+ $this->language,
+ $this->mimetype_guesser,
+ $this->phpbb_dispatcher,
+ $this->plupload,
+ $this->user,
+ $this->phpbb_root_path
+ );
+
+ $filedata = $this->upload->upload('foobar', 1, true);
+
+ $this->assertSame(array(
+ 'error' => array(),
+ 'post_attach' => false,
+ ), $filedata);
+ }
}