Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PMA_ifSetOr_test.php « test - github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4e9dce185f04fa8487c016b1859756d0f0557a5b (plain)
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
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * tests for PMA_ifSetOr()
 *
 * @version $Id$
 * @package phpMyAdmin-test
 */

/**
 *
 */
require_once 'PHPUnit/Framework.php';
require_once './libraries/core.lib.php';

/**
 * @package phpMyAdmin-test
 */
class PMA_ifSetOr_test extends PHPUnit_Framework_TestCase
{
    public function testVarSet()
    {
        $default = 'foo';
        $in = 'bar';
        $out = PMA_ifSetOr($in, $default);
        $this->assertEquals($in, $out);
    }
    public function testVarSetWrongType()
    {
        $default = 'foo';
        $in = 'bar';
        $out = PMA_ifSetOr($in, $default, 'boolean');
        $this->assertEquals($out, $default);
    }
    public function testVarNotSet()
    {
        $default = 'foo';
        // $in is not set!
        $out = PMA_ifSetOr($in, $default);
        $this->assertEquals($out, $default);
    }
    public function testVarNotSetNoDefault()
    {
        // $in is not set!
        $out = PMA_ifSetOr($in);
        $this->assertEquals($out, null);
    }

}
?>