added new test for checking var against array of valid values;
fixed some test not properly working;
This commit is contained in:
@@ -71,32 +71,42 @@ class PMA_isValid_test extends PHPUnit_Framework_TestCase
|
|||||||
public function testNotScalarArray()
|
public function testNotScalarArray()
|
||||||
{
|
{
|
||||||
$var = array('test');
|
$var = array('test');
|
||||||
$this->assertFalse(PMA_isValid($var), 'scalar');
|
$this->assertFalse(PMA_isValid($var, 'scalar'));
|
||||||
}
|
}
|
||||||
public function testNotScalarNull()
|
public function testNotScalarNull()
|
||||||
{
|
{
|
||||||
$var = null;
|
$var = null;
|
||||||
$this->assertFalse(PMA_isValid($var), 'scalar');
|
$this->assertFalse(PMA_isValid($var, 'scalar'));
|
||||||
}
|
}
|
||||||
public function testNumericInt()
|
public function testNumericInt()
|
||||||
{
|
{
|
||||||
$var = 1;
|
$var = 1;
|
||||||
$this->assertTrue(PMA_isValid($var), 'numeric');
|
$this->assertTrue(PMA_isValid($var, 'numeric'));
|
||||||
}
|
}
|
||||||
public function testNumericFloat()
|
public function testNumericFloat()
|
||||||
{
|
{
|
||||||
$var = 1.1;
|
$var = 1.1;
|
||||||
$this->assertTrue(PMA_isValid($var), 'numeric');
|
$this->assertTrue(PMA_isValid($var, 'numeric'));
|
||||||
}
|
}
|
||||||
public function testNumericZero()
|
public function testNumericZero()
|
||||||
{
|
{
|
||||||
$var = 0;
|
$var = 0;
|
||||||
$this->assertTrue(PMA_isValid($var), 'numeric');
|
$this->assertTrue(PMA_isValid($var, 'numeric'));
|
||||||
}
|
}
|
||||||
public function testNumericString()
|
public function testNumericString()
|
||||||
{
|
{
|
||||||
$var = '+0.1';
|
$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', )));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user