File: VariablesTest.php

package info (click to toggle)
php-horde-util 2.5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 276 kB
  • ctags: 397
  • sloc: php: 2,119; xml: 734; sh: 8; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 945 bytes parent folder | download | duplicates (5)
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
<?php
/**
 * @author     Jan Schneider <jan@horde.org>
 * @license    http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @category   Horde
 * @package    Util
 * @subpackage UnitTests
 */

class Horde_Util_VariablesTest extends PHPUnit_Framework_TestCase
{
    public function testRemove()
    {
        $vars = new Horde_Variables(array(
           'a' => 'a',
           'b' => 'b',
           'c' => array(1, 2, 3),
           'd' => array(
               'z' => 'z',
               'y' => array(
                   'f' => 'f',
                   'g' => 'g'
               )
           )
        ));

        $vars->remove('a');
        $vars->remove('d[y][g]');

        $this->assertNull($vars->a);
        $this->assertEquals('b', $vars->b);
        $this->assertEquals(array(1, 2, 3), $vars->c);
        $this->assertEquals(
            array('z' => 'z',
                  'y' => array('f' => 'f')),
            $vars->d
        );
    }
}