2 /* vim: set expandtab sw=4 ts=4 sts=4: */
7 * @package phpMyAdmin-test
13 require_once 'PHPUnit/Framework.php';
14 require_once './libraries/core.lib.php';
17 * @package phpMyAdmin-test
19 class PMA_isValid_test
extends PHPUnit_Framework_TestCase
21 public function testVarNotSetAfterTest()
24 $this->assertFalse(isset($var));
26 public function testNotSet()
28 $this->assertFalse(PMA_isValid($var));
30 public function testEmptyString()
33 $this->assertFalse(PMA_isValid($var));
35 public function testNotEmptyString()
38 $this->assertTrue(PMA_isValid($var));
40 public function testZero()
43 $this->assertTrue(PMA_isValid($var));
45 public function testNullFail()
48 $this->assertFalse(PMA_isValid($var));
50 public function testNotSetArray()
52 $this->assertFalse(PMA_isValid($array['x']));
54 public function testScalarString()
57 $this->assertTrue(PMA_isValid($var, 'scalar'));
59 public function testScalarInt()
62 $this->assertTrue(PMA_isValid($var, 'scalar'));
64 public function testScalarFloat()
67 $this->assertTrue(PMA_isValid($var, 'scalar'));
69 public function testScalarBool()
72 $this->assertTrue(PMA_isValid($var, 'scalar'));
74 public function testNotScalarArray()
77 $this->assertFalse(PMA_isValid($var, 'scalar'));
79 public function testNotScalarNull()
82 $this->assertFalse(PMA_isValid($var, 'scalar'));
84 public function testNumericInt()
87 $this->assertTrue(PMA_isValid($var, 'numeric'));
89 public function testNumericFloat()
92 $this->assertTrue(PMA_isValid($var, 'numeric'));
94 public function testNumericZero()
97 $this->assertTrue(PMA_isValid($var, 'numeric'));
99 public function testNumericString()
102 $this->assertTrue(PMA_isValid($var, 'numeric'));
104 public function testValueInArray()
107 $this->assertTrue(PMA_isValid($var, array('a', 'b', )));
109 public function testValueNotInArray()
112 $this->assertFalse(PMA_isValid($var, array('a', 'b', )));