Classi per la configurazione upload
Cristiano Magro
2019-07-09 2421604aa16e3f953cc61bcfe228c5b6314685b0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
 * User: Cristiano Magro
 * Date: 09/07/2019
 */
 
class FilterExtTest extends PHPUnit_Framework_TestCase
{
    /** @var FilterExt $object */
    protected $object;
 
    /**
     * Set up fixture, inizializzazione dei test.
     * Eseguito prima di ogni test
     */
    protected function setUp()
    {
        $this->object = new FilterExt();
    }
 
    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     */
    protected function tearDown()
    {
 
    }
 
    public function testCreateNewFilter()
    {
        $atteso = '{"title":"titolo","extensions":"ext"}';
        $obj = new FilterExt('titolo', 'ext');
 
        $this->assertEquals($atteso, $obj->getFilter());
    }
 
    public function testAddExt()
    {
        $atteso = '{"title":"titolo","extensions":"ciccio,ext"}';
 
        $obj = new FilterExt('titolo', 'ext');
        $obj->addExt('ciccio');
 
        $this->assertEquals($atteso, $obj->getFilter());
    }
 
    public function testDuplicatoExt()
    {
        $atteso = '{"title":"titolo","extensions":"ext"}';
 
        $obj = new FilterExt('titolo', 'ext');
        $obj->addExt('ext');
 
        $this->assertEquals($atteso, $obj->getFilter());
    }
 
    /**
     * Le estensioni possono differire tra maiuscolo e minuscolo.
     */
    public function testDuplicatoUpper()
    {
        $atteso = '{"title":"qualcosa","extensions":"Ext,ext"}';
 
        $obj = new FilterExt('qualcosa', 'ext');
        $obj->addExt('Ext');
 
        $this->assertEquals($atteso, $obj->getFilter());
    }
 
}