CQM/CDR Reporting age calculation bug fix
[openemr.git] / phpmyadmin / test / PMA_isValid_test.php
blob47bfb2814552449428ed5cf335c6e0f676020ad2
1 <?php
2 /* vim: expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for PMA_pow()
6 * @version $Id$
7 * @package phpMyAdmin-test
8 */
10 /**
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()
20 PMA_isValid($var);
21 $this->assertFalse(isset($var));
23 public function testNotSet()
25 $this->assertFalse(PMA_isValid($var));
27 public function testEmptyString()
29 $var = '';
30 $this->assertFalse(PMA_isValid($var));
32 public function testNotEmptyString()
34 $var = '0';
35 $this->assertTrue(PMA_isValid($var));
37 public function testZero()
39 $var = 0;
40 $this->assertTrue(PMA_isValid($var));
42 public function testNullFail()
44 $var = null;
45 $this->assertFalse(PMA_isValid($var));
47 public function testNotSetArray()
49 $this->assertFalse(PMA_isValid($array['x']));
51 public function testScalarString()
53 $var = 'string';
54 $this->assertTrue(PMA_isValid($var, 'scalar'));
56 public function testScalarInt()
58 $var = 1;
59 $this->assertTrue(PMA_isValid($var, 'scalar'));
61 public function testScalarFloat()
63 $var = 1.1;
64 $this->assertTrue(PMA_isValid($var, 'scalar'));
66 public function testScalarBool()
68 $var = true;
69 $this->assertTrue(PMA_isValid($var, 'scalar'));
71 public function testNotScalarArray()
73 $var = array('test');
74 $this->assertFalse(PMA_isValid($var, 'scalar'));
76 public function testNotScalarNull()
78 $var = null;
79 $this->assertFalse(PMA_isValid($var, 'scalar'));
81 public function testNumericInt()
83 $var = 1;
84 $this->assertTrue(PMA_isValid($var, 'numeric'));
86 public function testNumericFloat()
88 $var = 1.1;
89 $this->assertTrue(PMA_isValid($var, 'numeric'));
91 public function testNumericZero()
93 $var = 0;
94 $this->assertTrue(PMA_isValid($var, 'numeric'));
96 public function testNumericString()
98 $var = '+0.1';
99 $this->assertTrue(PMA_isValid($var, 'numeric'));
101 public function testValueInArray()
103 $var = 'a';
104 $this->assertTrue(PMA_isValid($var, array('a', 'b', )));
106 public function testValueNotInArray()
108 $var = 'c';
109 $this->assertFalse(PMA_isValid($var, array('a', 'b', )));