summaryrefslogtreecommitdiff
path: root/tests/units/Helper/FileHelperTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/Helper/FileHelperTest.php')
-rw-r--r--tests/units/Helper/FileHelperTest.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/units/Helper/FileHelperTest.php b/tests/units/Helper/FileHelperTest.php
new file mode 100644
index 00000000..7db43460
--- /dev/null
+++ b/tests/units/Helper/FileHelperTest.php
@@ -0,0 +1,43 @@
+<?php
+
+require_once __DIR__.'/../Base.php';
+
+use Kanboard\Helper\FileHelper;
+
+class FileHelperTest extends Base
+{
+ public function testIcon()
+ {
+ $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('markdown', $helper->getPreviewType('test.md'));
+ $this->assertEquals(null, $helper->getPreviewType('test.doc'));
+ }
+
+ public function testGetBrowserViewType()
+ {
+ $fileHelper = new FileHelper($this->container);
+ $this->assertSame('application/pdf', $fileHelper->getBrowserViewType('SomeFile.PDF'));
+ $this->assertSame(null, $fileHelper->getBrowserViewType('SomeFile.doc'));
+ }
+}