From 54655e3e7145384132a6be67a13a7f62dbcf8fd1 Mon Sep 17 00:00:00 2001
From: Cristiano Magro <cristiano.magro@vola.it>
Date: Tue, 27 Aug 2019 11:35:47 +0200
Subject: [PATCH] Merge branch 'FilesFilter'

---
 tests/Vola/UploadFile/FilesFilterTest.php |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/tests/Vola/UploadFile/FilesFilterTest.php b/tests/Vola/UploadFile/FilesFilterTest.php
new file mode 100644
index 0000000..c06a178
--- /dev/null
+++ b/tests/Vola/UploadFile/FilesFilterTest.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * User: Cristiano Magro
+ * Date: 08/07/2019
+ */
+
+class FilesFilterTest extends PHPUnit_Framework_TestCase
+{
+    /** @var FilesFilter $object */
+    protected $object;
+
+    /**
+     * Set up fixture, inizializzazione dei test.
+     * Eseguito prima di ogni test
+     */
+    protected function setUp()
+    {
+        $this->object = new FilesFilter();
+    }
+
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown()
+    {
+
+    }
+
+    /**
+     * @dataProvider addExtension
+     */
+    public function testAddExtension($lista, $atteso)
+    {
+
+        foreach ($lista as $item) {
+            $this->object->addExt($item);
+        }
+
+        $esito = $this->object->toJson();
+
+        $this->assertEquals($atteso, $esito);
+    }
+
+    public function addExtension()
+    {
+        return [
+            [[], '[]'],
+            [['fasullo'], '[]'],
+            [['gif'], '[{"title":"Image files","extensions":"gif"}]'],
+            [['doc'], '[{"title":"Documenti","extensions":"doc"}]'],
+            [['DOC'], '[{"title":"Documenti","extensions":"DOC"}]'],
+            [['txt'], '[{"title":"Documenti","extensions":"txt"}]'],
+            [['DOc', 'gif'], '[{"title":"Documenti","extensions":"DOc"},{"title":"Image files","extensions":"gif"}]'],
+            [['txt', 'doc'], '[{"title":"Documenti","extensions":"doc,txt"}]'],
+            [['gif', 'fasullo'], '[{"title":"Image files","extensions":"gif"}]'],
+        ];
+    }
+
+
+    public function testDecodeTitolo()
+    {
+        $atteso = "Documenti";
+
+        $this->assertEquals($atteso, $this->object->decodeTitolo('Doc'));
+        $this->assertEquals($atteso, $this->object->decodeTitolo('doc'));
+    }
+
+}
\ No newline at end of file

--
Gitblit v1.8.0