From a5480de8521c7377a47e5ce4ad963d247646e2ae Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Mon, 10 Jun 2013 22:22:44 +0300 Subject: [PATCH] Test case "FileHelperTest::testGetMimeTypeByExtension()" has been added. --- tests/unit/framework/helpers/FileHelperTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/unit/framework/helpers/FileHelperTest.php b/tests/unit/framework/helpers/FileHelperTest.php index e3bd343..c74f20c 100644 --- a/tests/unit/framework/helpers/FileHelperTest.php +++ b/tests/unit/framework/helpers/FileHelperTest.php @@ -278,4 +278,21 @@ class FileHelperTest extends TestCase FileHelper::mkdir($dirName, null, true); $this->assertTrue(file_exists($dirName), 'Unable to create directory recursively!'); } + + public function testGetMimeTypeByExtension() + { + $magicFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'mime_type.php'; + $mimeTypeMap = array( + 'txa' => 'application/json', + 'txb' => 'another/mime', + ); + $magicFileContent = ' $mimeType) { + $fileName = 'test.' . $extension; + $this->assertNull(FileHelper::getMimeTypeByExtension($fileName)); + $this->assertEquals($mimeType, FileHelper::getMimeTypeByExtension($fileName, $magicFile)); + } + } } \ No newline at end of file