phpmyadmin/test/classes/MimeTest.php
Maurício Meneghini Fauth e143d36344 Refactor mime.lib.php function to a static method
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
2017-09-12 12:22:45 -03:00

64 lines
1.2 KiB
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PhpMyAdmin\Mime
*
* @package PhpMyAdmin-test
*/
namespace PhpMyAdmin;
use PhpMyAdmin\Mime;
/**
* Test for mime detection.
*
* @package PhpMyAdmin-test
*/
class MimeTest extends \PHPUnit_Framework_TestCase
{
/**
* Test for Mime::detect
*
* @param string $test MIME to test
* @param string $output Expected output
*
* @return void
* @dataProvider providerForTestDetect
*/
public function testDetect($test, $output)
{
$this->assertEquals(
Mime::detect($test),
$output
);
}
/**
* Provider for testDetect
*
* @return array data for testDetect
*/
public function providerForTestDetect()
{
return array(
array(
'pma',
'application/octet-stream'
),
array(
'GIF',
'image/gif'
),
array(
"\x89PNG",
'image/png'
),
array(
chr(0xff) . chr(0xd8),
'image/jpeg'
),
);
}
}