aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mimetype
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-11-11 20:15:28 +0100
committerMarc Alexander <admin@m-a-styles.de>2013-11-11 20:15:28 +0100
commitb1719db47df4f3089f90bbfac2ca0bec24dcf027 (patch)
treead5ef7146be33665740b2b639e34bc6df084fd6f /tests/mimetype
parent3bd42895625689e7620ac189f41f24506de00007 (diff)
downloadforums-b1719db47df4f3089f90bbfac2ca0bec24dcf027.tar
forums-b1719db47df4f3089f90bbfac2ca0bec24dcf027.tar.gz
forums-b1719db47df4f3089f90bbfac2ca0bec24dcf027.tar.bz2
forums-b1719db47df4f3089f90bbfac2ca0bec24dcf027.tar.xz
forums-b1719db47df4f3089f90bbfac2ca0bec24dcf027.zip
[ticket/11912] Add extension_guesser for guessing mimetype by extension
The content_guesser now only guesses the mimetype with the function mime_content_type() while the guessing by extension is done using the extension_guesser. PHPBB3-11912
Diffstat (limited to 'tests/mimetype')
-rw-r--r--tests/mimetype/guesser_test.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php
index 9d4d965d63..8d076abae5 100644
--- a/tests/mimetype/guesser_test.php
+++ b/tests/mimetype/guesser_test.php
@@ -101,25 +101,34 @@ class guesser_test extends \phpbb_test_case
'image/jpeg',
'image/jpeg',
),
+ array(new \phpbb\mimetype\content_guesser),
false,
),
array(
array(
'application/octet-stream',
- 'image/jpeg',
+ 'application/octet-stream',
),
+ array(new \phpbb\mimetype\content_guesser),
true,
),
+ array(
+ array(
+ 'application/octet-stream',
+ 'image/jpeg',
+ ),
+ array(new \phpbb\mimetype\extension_guesser),
+ ),
);
}
/**
* @dataProvider data_content_guesser
*/
- public function test_content_guesser($expected, $overload = false)
+ public function test_content_guesser($expected, $guessers, $overload = false)
{
self::$function_exists = ($overload) ? false : true;
- $guesser = new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\content_guesser));
+ $guesser = new \phpbb\mimetype\guesser($guessers);
$this->assertEquals($expected[0], $guesser->guess($this->jpg_file));
$this->assertEquals($expected[1], $guesser->guess($this->jpg_file, $this->jpg_file . '.jpg'));
@copy($this->jpg_file, $this->jpg_file . '.jpg');