From 66d62dd96dabfe7fa204fe5f201c015a0b3d2838 Mon Sep 17 00:00:00 2001 From: Martijn van Maasakkers Date: Tue, 15 Oct 2013 21:21:30 +0200 Subject: [PATCH] Removed silly string = true check --- src/Valitron/Validator.php | 7 +------ tests/Valitron/ValidateTest.php | 14 -------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/Valitron/Validator.php b/src/Valitron/Validator.php index 939df50..abf0f89 100644 --- a/src/Valitron/Validator.php +++ b/src/Valitron/Validator.php @@ -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; } diff --git a/tests/Valitron/ValidateTest.php b/tests/Valitron/ValidateTest.php index cc1c8a6..c859550 100644 --- a/tests/Valitron/ValidateTest.php +++ b/tests/Valitron/ValidateTest.php @@ -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) {