Completed
Push — master ( 298f36...c6c82d )
by Mihail
06:19 queued 10s
created

MimeTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 11
c 4
b 0
f 0
dl 0
loc 40
rs 10
wmc 7
1
<?php
2
3
namespace Koded\Stdlib;
4
5
use PHPUnit\Framework\TestCase;
6
7
class MimeTest extends TestCase
8
{
9
10
    public function test_when_mime_is_not_found_it_should_return_empty_value()
11
    {
12
        $this->assertSame('', Mime::type('fubar-type'));
13
    }
14
15
    public function test_return_first_known_mime_type()
16
    {
17
        $this->assertSame('application/x-httpd-php', Mime::type('php'));
18
    }
19
20
    public function test_return_known_mime_type_by_index()
21
    {
22
        $this->assertSame('text/csv', Mime::type('csv', 3));
23
    }
24
25
    public function test_mime_list()
26
    {
27
        $this->assertSame(
28
            ['application/x-zip', 'application/zip', 'application/x-zip-compressed'],
29
            Mime::types('zip')
30
        );
31
    }
32
33
    public function test_unknown_mime_list()
34
    {
35
        $this->assertSame([], Mime::types('junk-extension-name'));
36
    }
37
38
    public function test_supports()
39
    {
40
        $this->assertTrue(Mime::supports('application/x-msg'));
41
        $this->assertFalse(Mime::supports('fubar'));
42
    }
43
44
    public function test_extensions()
45
    {
46
        $this->assertEquals(['json'], Mime::extensions('application/json'));
47
    }
48
}
49