added new test for checking var against array of valid values;

fixed some test not properly working;
This commit is contained in:
Sebastian Mendel
2007-05-09 13:03:18 +00:00
parent 9256caa3a0
commit 042fedf51c

View File

@@ -71,32 +71,42 @@ class PMA_isValid_test extends PHPUnit_Framework_TestCase
public function testNotScalarArray()
{
$var = array('test');
$this->assertFalse(PMA_isValid($var), 'scalar');
$this->assertFalse(PMA_isValid($var, 'scalar'));
}
public function testNotScalarNull()
{
$var = null;
$this->assertFalse(PMA_isValid($var), 'scalar');
$this->assertFalse(PMA_isValid($var, 'scalar'));
}
public function testNumericInt()
{
$var = 1;
$this->assertTrue(PMA_isValid($var), 'numeric');
$this->assertTrue(PMA_isValid($var, 'numeric'));
}
public function testNumericFloat()
{
$var = 1.1;
$this->assertTrue(PMA_isValid($var), 'numeric');
$this->assertTrue(PMA_isValid($var, 'numeric'));
}
public function testNumericZero()
{
$var = 0;
$this->assertTrue(PMA_isValid($var), 'numeric');
$this->assertTrue(PMA_isValid($var, 'numeric'));
}
public function testNumericString()
{
$var = '+0.1';
$this->assertTrue(PMA_isValid($var), 'numeric');
$this->assertTrue(PMA_isValid($var, 'numeric'));
}
public function testValueInArray()
{
$var = 'a';
$this->assertTrue(PMA_isValid($var, array('a', 'b', )));
}
public function testValueNotInArray()
{
$var = 'c';
$this->assertFalse(PMA_isValid($var, array('a', 'b', )));
}
}
?>