mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/11912] Expect logic exceptions in test if no guesser available
PHPBB3-11912
This commit is contained in:
parent
943ab555da
commit
c9c419c431
1 changed files with 13 additions and 0 deletions
|
@ -127,7 +127,20 @@ class guesser_test extends \phpbb_test_case
|
||||||
*/
|
*/
|
||||||
public function test_content_guesser($expected, $guessers, $overload = false)
|
public function test_content_guesser($expected, $guessers, $overload = false)
|
||||||
{
|
{
|
||||||
|
$supported = false;
|
||||||
self::$function_exists = !$overload;
|
self::$function_exists = !$overload;
|
||||||
|
|
||||||
|
// Cover possible LogicExceptions
|
||||||
|
foreach ($guessers as $cur_guesser)
|
||||||
|
{
|
||||||
|
$supported += $cur_guesser->is_supported();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$supported)
|
||||||
|
{
|
||||||
|
$this->setExpectedException('\LogicException');
|
||||||
|
}
|
||||||
|
|
||||||
$guesser = new \phpbb\mimetype\guesser($guessers);
|
$guesser = new \phpbb\mimetype\guesser($guessers);
|
||||||
$this->assertEquals($expected[0], $guesser->guess($this->jpg_file));
|
$this->assertEquals($expected[0], $guesser->guess($this->jpg_file));
|
||||||
$this->assertEquals($expected[1], $guesser->guess($this->jpg_file, $this->jpg_file . '.jpg'));
|
$this->assertEquals($expected[1], $guesser->guess($this->jpg_file, $this->jpg_file . '.jpg'));
|
||||||
|
|
Loading…
Add table
Reference in a new issue