Classi per la configurazione upload
Cristiano Magro
2019-07-08 f3a323ad32817b3a5324387356c386453181cfe9
method add per extention
2 files modified
23 ■■■■■ changed files
src/Vola/UploadFile/FilesFilter.class.php 12 ●●●●● patch | view | raw | blame | history
tests/Vola/UploadFile/FilesFilterTest.php 11 ●●●●● patch | view | raw | blame | history
src/Vola/UploadFile/FilesFilter.class.php
@@ -6,8 +6,18 @@
class FilesFilter {
    private $filtro = array();
    public function toJson()
    {
        return '{}';
        return json_encode($this->filtro);
    }
    public function addExt($extension = '')
    {
        if ($extension != ''){
            $this->filtro[] = json_decode('{"title":"Image files", "extensions":"gif"}', true);
        }
        return $this;
    }
}
tests/Vola/UploadFile/FilesFilterTest.php
@@ -28,6 +28,17 @@
    public function testEmpty()
    {
        $atteso = '{}';
        $atteso = '[]';
        $esito = $this->object->toJson();
        $this->assertEquals($atteso, $esito);
    }
    public function testAddGif()
    {
        $atteso = '{"title":"Image files","extensions":"gif"}';
        $this->object->addExt('gif');
        $esito = $this->object->toJson();
        
        $this->assertEquals($atteso, $esito);