-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[InputFilter][Hotfix] Missing check for allowEmpty() #4567
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -564,6 +564,22 @@ public function testValidationMarksInputInvalidWhenRequiredAndAllowEmptyFlagIsFa | |
$this->assertFalse($filter->isValid()); | ||
} | ||
|
||
public function testValidationMarksInputInvalidWhenNotRequiredAndAllowEmptyFlagIsFalse() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, on reading this test case title... I think this would be a break. By default, "allow empty" is So, the question I have, then is: should calling |
||
{ | ||
$filter = new InputFilter(); | ||
|
||
$foo = new Input(); | ||
$foo->setRequired(false); | ||
$foo->setAllowEmpty(false); | ||
|
||
$filter->add($foo, 'foo'); | ||
|
||
$data = array('foo' => ''); | ||
$filter->setData($data); | ||
|
||
$this->assertFalse($filter->isValid()); | ||
} | ||
|
||
public static function contextDataProvider() | ||
{ | ||
return array( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be OR'd with the previous statement.