From b55c48b8d8b8ac9dc71da68c3f705ec658b67e2c Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Fri, 16 Oct 2009 08:10:26 +0000 Subject: [PATCH] Added unittest for PMA_ifSetOr() --- libraries/core.lib.php | 1 - test/PMA_ifSetOr_test.php | 50 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 test/PMA_ifSetOr_test.php diff --git a/libraries/core.lib.php b/libraries/core.lib.php index 6e764dd24..a44971084 100644 --- a/libraries/core.lib.php +++ b/libraries/core.lib.php @@ -30,7 +30,6 @@ * echo PMA_ifSetOr($cfg['ForceSSL'], false, 'boolean'); // true * * - * @todo create some testsuites * @uses PMA_isValid() * @see PMA_isValid() * @param mixed $var param to check diff --git a/test/PMA_ifSetOr_test.php b/test/PMA_ifSetOr_test.php new file mode 100644 index 000000000..4e9dce185 --- /dev/null +++ b/test/PMA_ifSetOr_test.php @@ -0,0 +1,50 @@ +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); + } + +} +?>