2 /* vim: set expandtab sw=4 ts=4 sts=4: */
6 * @package phpMyAdmin-test
12 require_once 'PHPUnit/Framework.php';
13 require_once './libraries/core.lib.php';
16 * @package phpMyAdmin-test
18 class PMA_isValid_test
extends PHPUnit_Framework_TestCase
20 public function testVarNotSetAfterTest()
23 $this->assertFalse(isset($var));
25 public function testNotSet()
27 $this->assertFalse(PMA_isValid($var));
29 public function testEmptyString()
32 $this->assertFalse(PMA_isValid($var));
34 public function testNotEmptyString()
37 $this->assertTrue(PMA_isValid($var));
39 public function testZero()
42 $this->assertTrue(PMA_isValid($var));
44 public function testNullFail()
47 $this->assertFalse(PMA_isValid($var));
49 public function testNotSetArray()
51 $this->assertFalse(PMA_isValid($array['x']));
53 public function testScalarString()
56 $this->assertTrue(PMA_isValid($var, 'scalar'));
58 public function testScalarInt()
61 $this->assertTrue(PMA_isValid($var, 'scalar'));
63 public function testScalarFloat()
66 $this->assertTrue(PMA_isValid($var, 'scalar'));
68 public function testScalarBool()
71 $this->assertTrue(PMA_isValid($var, 'scalar'));
73 public function testNotScalarArray()
76 $this->assertFalse(PMA_isValid($var, 'scalar'));
78 public function testNotScalarNull()
81 $this->assertFalse(PMA_isValid($var, 'scalar'));
83 public function testNumericInt()
86 $this->assertTrue(PMA_isValid($var, 'numeric'));
88 public function testNumericFloat()
91 $this->assertTrue(PMA_isValid($var, 'numeric'));
93 public function testNumericZero()
96 $this->assertTrue(PMA_isValid($var, 'numeric'));
98 public function testNumericString()
101 $this->assertTrue(PMA_isValid($var, 'numeric'));
103 public function testValueInArray()
106 $this->assertTrue(PMA_isValid($var, array('a', 'b', )));
108 public function testValueNotInArray()
111 $this->assertFalse(PMA_isValid($var, array('a', 'b', )));