diff options
author | Tristan Darricau <github@nicofuma.fr> | 2014-09-06 13:54:16 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-09-06 13:54:16 +0200 |
commit | e0711b417fb9e9106af52dcde51ca20dd7b056f2 (patch) | |
tree | 4a866d9599bc802800fdb17420efd23bfc640f53 /tests | |
parent | bc38730ab5e7d59e8e0b1b13c0cd8f3fb32f271a (diff) | |
parent | 6387bf8d1399b9ccf995b8eb5a4b93425d27e873 (diff) | |
download | forums-e0711b417fb9e9106af52dcde51ca20dd7b056f2.tar forums-e0711b417fb9e9106af52dcde51ca20dd7b056f2.tar.gz forums-e0711b417fb9e9106af52dcde51ca20dd7b056f2.tar.bz2 forums-e0711b417fb9e9106af52dcde51ca20dd7b056f2.tar.xz forums-e0711b417fb9e9106af52dcde51ca20dd7b056f2.zip |
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus:
[ticket/13031] Slightly change behavior of choose_mime_type and add unit tests
[ticket/13031] Guess with all mimetype guessers and pick best guess
[ticket/13031] Only use mimetype guesser guess if it helps us
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/fileupload_form_test.php | 4 | ||||
-rw-r--r-- | tests/mimetype/guesser_test.php | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php index e87953367f..b8c48389e0 100644 --- a/tests/functional/fileupload_form_test.php +++ b/tests/functional/fileupload_form_test.php @@ -107,9 +107,9 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case $crawler = $this->upload_file('disallowed.jpg', 'image/jpeg'); - // Hitting the ATTACHED_IMAGE_NOT_IMAGE error means we passed the + // Hitting the UNABLE_GET_IMAGE_SIZE error means we passed the // DISALLOWED_CONTENT check - $this->assertContains($this->lang('ATTACHED_IMAGE_NOT_IMAGE'), $crawler->text()); + $this->assertContainsLang('UNABLE_GET_IMAGE_SIZE', $crawler->text()); } public function test_too_large() diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php index b74a9f236e..fa53e6c8c4 100644 --- a/tests/mimetype/guesser_test.php +++ b/tests/mimetype/guesser_test.php @@ -206,4 +206,25 @@ class guesser_test extends \phpbb_test_case $this->assertInstanceOf('\phpbb\mimetype\content_guesser', $guessers[0]); $this->assertInstanceOf('\phpbb\mimetype\extension_guesser', $guessers[3]); } + + public function data_choose_mime_type() + { + return array( + array('application/octet-stream', 'application/octet-stream', null), + array('application/octet-stream', 'application/octet-stream', 'application/octet-stream'), + array('binary', 'application/octet-stream', 'binary'), + array('image/jpeg', 'application/octet-stream', 'image/jpeg'), + array('image/jpeg', 'binary', 'image/jpeg'), + array('image/jpeg', 'image/jpg', 'image/jpeg'), + array('image/jpeg', 'image/jpeg', 'binary'), + ); + } + + /** + * @dataProvider data_choose_mime_type + */ + public function test_choose_mime_type($expected, $mime_type, $guess) + { + $this->assertSame($expected, $this->guesser->choose_mime_type($mime_type, $guess)); + } } |