HelperFormElementTest.php 1.22 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

/**
 * Created by PhpStorm.
 * User: crose
 * Date: 1/26/16
 * Time: 2:56 PM
 */

namespace qfq;

use qfq\HelperFormElement;

require_once(__DIR__ . '/../../qfq/helper/HelperFormElement.php');
require_once(__DIR__ . '/../../qfq/Constants.php');

class HelperFormElementTest extends \PHPUnit_Framework_TestCase {

19
    public function testExplodeFieldParameter() {
20
        $a = array();
21
        HelperFormElement::explodeParameterInArrayElements($a);
22
23
24
25
26
        $this->assertEquals(array(), $a, "Both arrays should be equal and empty");

        $a = [0 => ['id' => 100, 'parameter' => "work=12\nlist=1:new,2:edit,3:delete"]];
        $b = [0 => ['id' => 100, 'parameter' => "work=12\nlist=1:new,2:edit,3:delete", 'work' => 12, 'list' => '1:new,2:edit,3:delete']];

27
        HelperFormElement::explodeParameterInArrayElements($a);
28
29
30
31
        $this->assertEquals($b, $a, "Both arrays should be equal");
    }

    /**
32
     * @expectedException \qfq\UserException
33
34
     *
     */
35
    public function testExplodeFieldParameterException() {
36
37

        $a = [0 => ['id' => 111, 'name' => 'hello', 'collision' => 'dummy', 'parameter' => "work=12\ncollision=1:new,2:edit,3:delete"]];
38
        HelperFormElement::explodeParameterInArrayElements($a);
39
40
41
42

    }

}