Fixed: Not selecting a datalabel used to issue a notice(undefined offset)
[phpmyadmin/ammaryasirr.git] / test / libraries / core / PMA_ifSetOr_test.php
blob35ffa967af95544410c78343d7ac693b22cc4e24
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Tests for PMA_ifSetOr() from libraries/core.lib.php
6 * @package phpMyAdmin-test
7 */
9 /*
10 * Include to test.
12 require_once 'libraries/core.lib.php';
14 class PMA_ifSetOr_test extends PHPUnit_Framework_TestCase
16 public function testVarSet()
18 $default = 'foo';
19 $in = 'bar';
20 $out = PMA_ifSetOr($in, $default);
21 $this->assertEquals($in, $out);
23 public function testVarSetWrongType()
25 $default = 'foo';
26 $in = 'bar';
27 $out = PMA_ifSetOr($in, $default, 'boolean');
28 $this->assertEquals($out, $default);
30 public function testVarNotSet()
32 $default = 'foo';
33 // $in is not set!
34 $out = PMA_ifSetOr($in, $default);
35 $this->assertEquals($out, $default);
37 public function testVarNotSetNoDefault()
39 // $in is not set!
40 $out = PMA_ifSetOr($in);
41 $this->assertEquals($out, null);