From fe0f1d589b2320905fa3dd73737d5b7b1cbc402a Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 28 May 2013 14:59:44 -0400
Subject: [PATCH] Improve rcube_utils::file2class() to not return duplicates

---
 tests/Framework/Utils.php |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php
index 7c1e92a..65efeec 100644
--- a/tests/Framework/Utils.php
+++ b/tests/Framework/Utils.php
@@ -229,4 +229,20 @@
         }
     }
 
+    /**
+     * rcube:utils::file2class()
+     */
+    function test_file2class()
+    {
+        $test = array(
+            array('', '', 'unknown'),
+            array('text', 'text', 'text'),
+            array('image/png', 'image.png', 'image png'),
+        );
+
+        foreach ($test as $v) {
+            $result = rcube_utils::file2class($v[0], $v[1]);
+            $this->assertSame($v[2], $result);
+        }
+    }
 }

--
Gitblit v1.9.1