Classi per la configurazione upload
Cristiano Magro
2018-01-16 1c1c1609227ac2d757c074a4bb2c6df5d026bb51
tests/SetupUploadTest.php
@@ -1,7 +1,5 @@
<?php
require 'bootstrap.php';
/**
 * Implementazione dei test per la classe SetupUpload
 *
@@ -10,7 +8,7 @@
class SetupUploadTest extends PHPUnit_Framework_TestCase {
    /**
     *  @var $object SetupUpload
     *  @var $object SetupUpload
     */
    protected $object;
@@ -27,15 +25,16 @@
     * This method is called after a test is executed.
     */
    protected function tearDown() {
    }
    public static function setUpBeforeClass() {
    }
    /**
     * Conversione di una stringa nel corrispondente valore di byte
     *
     * @since 0.3.0
     */
    public function test_str2Bytes() {
@@ -60,11 +59,32 @@
        $this->assertEquals('0', SetupUpload::str2Bytes('0 mB'));
        $this->assertEquals('0', SetupUpload::str2Bytes('0 GB'));
        $this->assertEquals('0', SetupUpload::str2Bytes('0 TB'));
        $this->assertEquals('0', SetupUpload::str2Bytes('0 XB'));
    }
    /**
     * Conversione di una stringa nel corrispondente valore di byte, stringhe
     * non convertibili devono andare in errore
     *
     * @since             0.3.1
     * @expectedException Upload_Exc_Error
     * @dataProvider      getBytesStringNotValid
     */
    public function test_str2BytesNonValido($byteString) {
        SetupUpload::str2Bytes($byteString);
    }
    public function getBytesStringNotValid() {
        return array(
            array(''),
            array('b'),
            array('1 k'),
            array('1 a'),
        );
    }
    /**
     * La coda non inizializzata prevede un numero minimo di files
     *
     * @since 0.3.1
     */
    public function testDefaultValue() {
@@ -72,10 +92,11 @@
    }
    /**
     * Gestione di valori non adeguati
     * @since 0.3.1
     * @expectedException UploadFile_Exc
     * @dataProvider getNumMaxFilesException
     * Gestione di valori non adeguati
     *
     * @since             0.3.1
     * @expectedException Upload_Exc_Error
     * @dataProvider      getNumMaxFilesException
     */
    public function testNotValidNumMaxFilesGetException($num) {
        $this->object->setNumMaxFiles($num);
@@ -92,7 +113,8 @@
    /**
     * Caselle della coda valide
     * @since 0.3.1
     *
     * @since        0.3.1
     * @dataProvider getSomeMaxFiles
     */
    public function testSomeValidMaxFiles($num) {
@@ -111,6 +133,7 @@
    /**
     * Impostazioni delle dimensioni massime del totale caricabile
     *
     * @since 0.3.1
     */
    public function testSetSizeMaxFilesByte() {
@@ -126,6 +149,7 @@
    /**
     * Impostazioni delle dimensioni massime di un file
     *
     * @since 0.3.1
     */
    public function testSetSizeLimitFile() {