diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-04-03 18:26:39 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-04-04 11:48:41 +0200 |
commit | 91c3ad07eca3c755fd3be839af2956457e05d10f (patch) | |
tree | a7b77e0dc03d72d431e84aca903fb94c88aae506 /tests/functional/fileupload_form_test.php | |
parent | e4e3df0b37ea6a67ba6c5b4cd98850e0d2758723 (diff) | |
download | forums-91c3ad07eca3c755fd3be839af2956457e05d10f.tar forums-91c3ad07eca3c755fd3be839af2956457e05d10f.tar.gz forums-91c3ad07eca3c755fd3be839af2956457e05d10f.tar.bz2 forums-91c3ad07eca3c755fd3be839af2956457e05d10f.tar.xz forums-91c3ad07eca3c755fd3be839af2956457e05d10f.zip |
[ticket/10851] Add unit and functional tests for checking attachments
These tests will make sure that fileuploads now work as expected regarding
the check for disallowed content.
PHPBB3-10851
Diffstat (limited to 'tests/functional/fileupload_form_test.php')
-rw-r--r-- | tests/functional/fileupload_form_test.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php index c291712c71..eaa6d634a5 100644 --- a/tests/functional/fileupload_form_test.php +++ b/tests/functional/fileupload_form_test.php @@ -76,6 +76,39 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case $this->assertEquals($this->lang('DISALLOWED_EXTENSION', 'bif'), $crawler->filter('p.error')->text()); } + public function test_disallowed_content() + { + $this->login(); + + $crawler = $this->upload_file('disallowed.jpg', 'image/jpeg'); + $this->assertEquals($this->lang('DISALLOWED_CONTENT'), $crawler->filter('p.error')->text()); + } + + public function test_disallowed_content_no_check() + { + $this->login(); + $this->admin_login(); + $this->add_lang('ucp'); + $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_attachments&mode=attach'); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + + $values["config[check_attachment_content]"] = 0; + $form->setValues($values); + $crawler = self::submit($form); + + // Logout and back in for correct URL + $this->logout(); + $this->login(); + + $crawler = $this->upload_file('disallowed.jpg', 'image/jpeg'); + + // Hitting the UNABLE_GET_IMAGE_SIZE error means we passed the + // DISALLOWED_CONTENT check + $this->assertEquals($this->lang('UNABLE_GET_IMAGE_SIZE'), $crawler->filter('p.error')->text()); + } + public function test_too_large() { $this->create_user('fileupload'); |