-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Expand file tree
/
Copy pathMimeTest.php
More file actions
45 lines (39 loc) · 993 Bytes
/
Copy pathMimeTest.php
File metadata and controls
45 lines (39 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\Mime;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use function chr;
#[CoversClass(Mime::class)]
class MimeTest extends AbstractTestCase
{
/**
* Test for Mime::detect
*
* @param string $test MIME to test
* @param string $output Expected output
*/
#[DataProvider('providerForTestDetect')]
public function testDetect(string $test, string $output): void
{
self::assertSame(
Mime::detect($test),
$output,
);
}
/**
* Provider for testDetect
*
* @return string[][] data for testDetect
*/
public static function providerForTestDetect(): array
{
return [
['pma', 'application/octet-stream'],
['GIF', 'image/gif'],
["\x89PNG", 'image/png'],
[chr(0xff) . chr(0xd8), 'image/jpeg'],
];
}
}