diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-09-05 21:55:49 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-09-05 21:55:49 +0200 |
commit | 21029e9fd295bedfcc34555d32afd928a03392a1 (patch) | |
tree | 9e5a196841246bf15a6b442a0daa684f17691d4b /tests | |
parent | d31ff51785f42e3de255722a32f098ab49d1489c (diff) | |
download | forums-21029e9fd295bedfcc34555d32afd928a03392a1.tar forums-21029e9fd295bedfcc34555d32afd928a03392a1.tar.gz forums-21029e9fd295bedfcc34555d32afd928a03392a1.tar.bz2 forums-21029e9fd295bedfcc34555d32afd928a03392a1.tar.xz forums-21029e9fd295bedfcc34555d32afd928a03392a1.zip |
[ticket/13031] Slightly change behavior of choose_mime_type and add unit tests
The mime type 'application/octet-stream' will still always be overwritten by
proper guesses. However, guesses with guessers that have a higher priority
will now overwrite previous guesses even if the mime types of these guesses
had a slash in them.
PHPBB3-13031
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mimetype/guesser_test.php | 21 |
1 files changed, 21 insertions, 0 deletions
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)); + } } |