summaryrefslogtreecommitdiff
path: root/tests/units/Helper/FileHelperText.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/Helper/FileHelperText.php')
-rw-r--r--tests/units/Helper/FileHelperText.php29
1 files changed, 25 insertions, 4 deletions
diff --git a/tests/units/Helper/FileHelperText.php b/tests/units/Helper/FileHelperText.php
index a681c890..215b024b 100644
--- a/tests/units/Helper/FileHelperText.php
+++ b/tests/units/Helper/FileHelperText.php
@@ -2,14 +2,35 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\File;
+use Kanboard\Helper\FileHelper;
class FileHelperTest extends Base
{
public function testIcon()
{
- $h = new File($this->container);
- $this->assertEquals('fa-file-image-o', $h->icon('test.png'));
- $this->assertEquals('fa-file-o', $h->icon('test'));
+ $helper = new FileHelper($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 FileHelper($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 FileHelper($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'));
}
}