Merge branch 'QA_3_3'
[phpmyadmin-regexreplace.git] / test / PMA_ifSetOr_test.php
blobfbeb80ee0dad55e32f3a780ad6706e18fd5ccbce
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for PMA_ifSetOr()
6 * @package phpMyAdmin-test
7 */
9 /**
12 require_once 'PHPUnit/Framework.php';
13 require_once './libraries/core.lib.php';
15 /**
16 * @package phpMyAdmin-test
18 class PMA_ifSetOr_test extends PHPUnit_Framework_TestCase
20 public function testVarSet()
22 $default = 'foo';
23 $in = 'bar';
24 $out = PMA_ifSetOr($in, $default);
25 $this->assertEquals($in, $out);
27 public function testVarSetWrongType()
29 $default = 'foo';
30 $in = 'bar';
31 $out = PMA_ifSetOr($in, $default, 'boolean');
32 $this->assertEquals($out, $default);
34 public function testVarNotSet()
36 $default = 'foo';
37 // $in is not set!
38 $out = PMA_ifSetOr($in, $default);
39 $this->assertEquals($out, $default);
41 public function testVarNotSetNoDefault()
43 // $in is not set!
44 $out = PMA_ifSetOr($in);
45 $this->assertEquals($out, null);