From edddba5adda7a1cb9ae63bdadd647f5c8b1d3d99 Mon Sep 17 00:00:00 2001
From: Cristiano Magro <cristiano.magro@vola.it>
Date: Tue, 27 Aug 2019 18:03:33 +0200
Subject: [PATCH] Eseguo tutti i test senza stoppare al primo errore

---
 tests/Vola/UploadFile/FilesFilterTest.php |   50 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/tests/Vola/UploadFile/FilesFilterTest.php b/tests/Vola/UploadFile/FilesFilterTest.php
index f8b2b8b..c06a178 100644
--- a/tests/Vola/UploadFile/FilesFilterTest.php
+++ b/tests/Vola/UploadFile/FilesFilterTest.php
@@ -13,7 +13,8 @@
      * Set up fixture, inizializzazione dei test.
      * Eseguito prima di ogni test
      */
-    protected function setUp() {
+    protected function setUp()
+    {
         $this->object = new FilesFilter();
     }
 
@@ -21,27 +22,48 @@
      * Tears down the fixture, for example, closes a network connection.
      * This method is called after a test is executed.
      */
-    protected function tearDown() {
+    protected function tearDown()
+    {
 
     }
 
-    public function testEmpty()
+    /**
+     * @dataProvider addExtension
+     */
+    public function testAddExtension($lista, $atteso)
     {
-        $atteso = '{}';
-        $atteso = '[]';
-        $esito = $this->object->toJson();
-        
-        $this->assertEquals($atteso, $esito);
-    }
 
-    public function testAddGif()
-    {
-        $atteso = '{"title":"Image files","extensions":"gif"}';
+        foreach ($lista as $item) {
+            $this->object->addExt($item);
+        }
 
-        $this->object->addExt('gif');
         $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