summaryrefslogtreecommitdiff
path: root/tests/units/Helper/FileHelperText.php
blob: 6a1b78a421afad2b85f22514de63a306e2d9d835 (plain)
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
<?php

require_once __DIR__.'/../Base.php';

use Kanboard\Helper\File;

class FileHelperTest extends Base
{
    public function testIcon()
    {
        $helper = new File($this->container);
        $this->assertEquals('fa-file-image-o', $helper->icon('test.png'));
        $this->assertEquals('fa-file-o', $helper->icon('test'));
    }

    public function testGetMimeType()
    {
        $helper = new File($this->container);

        $this->assertEquals('image/jpeg', $helper->getImageMimeType('My File.JPG'));
        $this->assertEquals('image/jpeg', $helper->getImageMimeType('My File.jpeg'));
        $this->assertEquals('image/png', $helper->getImageMimeType('My File.PNG'));
        $this->assertEquals('image/gif', $helper->getImageMimeType('My File.gif'));
        $this->assertEquals('image/jpeg', $helper->getImageMimeType('My File.bmp'));
        $this->assertEquals('image/jpeg', $helper->getImageMimeType('My File'));
    }

    public function testGetPreviewType()
    {
        $helper = new File($this->container);
        $this->assertEquals('text', $helper->getPreviewType('test.txt'));
        $this->assertEquals('markdown', $helper->getPreviewType('test.markdown'));
        $this->assertEquals('md', $helper->getPreviewType('test.md'));
        $this->assertEquals(null, $helper->getPreviewType('test.doc'));
    }
}