Removed silly string = true check

This commit is contained in:
Martijn van Maasakkers 2013-10-15 21:21:30 +02:00
parent da56650a52
commit 66d62dd96d
2 changed files with 1 additions and 20 deletions

View File

@ -432,18 +432,13 @@ class Validator
/**
* Validate that a field contains a boolean.
* If $params[0] is true, it also check for string == true.
*
* @param string $field
* @param mixed $value
* @param array $params
* @return bool
*/
protected function validateBoolean($field, $value, $params)
protected function validateBoolean($field, $value)
{
if(isset($params[0]) && $params[0] == true && $value == "true") {
$value = true;
}
return (is_bool($value)) ? true : false;
}

View File

@ -637,20 +637,6 @@ class ValidateTest extends BaseTestCase
$v->rule('boolean', 'test');
$this->assertFalse($v->validate());
}
public function testBooleanStringValid()
{
$v = new Validator(array('test' => "true"));
$v->rule('boolean', 'test', true);
$this->assertTrue($v->validate());
}
public function testBooleanStringInvalid()
{
$v = new Validator(array('test' => 'notrue'));
$v->rule('boolean', 'test', true);
$this->assertFalse($v->validate());
}
}
function sampleFunctionCallback($field, $value, array $params) {