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';
16 class PMA_isValid_test
extends PHPUnit_Framework_TestCase
18 public function testVarNotSetAfterTest()
21 $this->assertFalse(isset($var));
23 public function testNotSet()
25 $this->assertFalse(PMA_isValid($var));
27 public function testEmptyString()
30 $this->assertFalse(PMA_isValid($var));
32 public function testNotEmptyString()
35 $this->assertTrue(PMA_isValid($var));
37 public function testZero()
40 $this->assertTrue(PMA_isValid($var));
42 public function testNullFail()
45 $this->assertFalse(PMA_isValid($var));
47 public function testNotSetArray()
49 $this->assertFalse(PMA_isValid($array['x']));
51 public function testScalarString()
54 $this->assertTrue(PMA_isValid($var, 'scalar'));
56 public function testScalarInt()
59 $this->assertTrue(PMA_isValid($var, 'scalar'));
61 public function testScalarFloat()
64 $this->assertTrue(PMA_isValid($var, 'scalar'));
66 public function testScalarBool()
69 $this->assertTrue(PMA_isValid($var, 'scalar'));
71 public function testNotScalarArray()
74 $this->assertFalse(PMA_isValid($var, 'scalar'));
76 public function testNotScalarNull()
79 $this->assertFalse(PMA_isValid($var, 'scalar'));
81 public function testNumericInt()
84 $this->assertTrue(PMA_isValid($var, 'numeric'));
86 public function testNumericFloat()
89 $this->assertTrue(PMA_isValid($var, 'numeric'));
91 public function testNumericZero()
94 $this->assertTrue(PMA_isValid($var, 'numeric'));
96 public function testNumericString()
99 $this->assertTrue(PMA_isValid($var, 'numeric'));
101 public function testValueInArray()
104 $this->assertTrue(PMA_isValid($var, array('a', 'b', )));
106 public function testValueNotInArray()
109 $this->assertFalse(PMA_isValid($var, array('a', 'b', )));