File tree 3 files changed +2
-12
lines changed
3 files changed +2
-12
lines changed Original file line number Diff line number Diff line change 23
23
"twig/twig" : " >=1.35"
24
24
},
25
25
"require-dev" : {
26
- "phpunit/phpunit" : " ~6.0" ,
27
26
"php-coveralls/php-coveralls" : " ^1.0" ,
27
+ "phpunit/phpunit" : " ^6.5" ,
28
28
"squizlabs/php_codesniffer" : " *"
29
29
},
30
30
"autoload" : {
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public function validate($value)
41
41
{
42
42
parent ::validate ($ value );
43
43
44
- if (!$ this ->validValue ($ value )) {
44
+ if (!$ this ->isEmpty ( $ value ) && ! $ this -> validValue ($ value )) {
45
45
if (is_array ($ value )) {
46
46
$ value_diff = array_diff ($ value , array_keys ($ this ->choices ));
47
47
$ value = implode (', ' , $ value_diff );
Original file line number Diff line number Diff line change @@ -61,16 +61,6 @@ public function testValidateChoiceUnexistent()
61
61
$ this ->field ->validate ("option2 " );
62
62
}
63
63
64
- /**
65
- * @expectedException PHPForm\Exceptions\ValidationError
66
- * @expectedExceptionMessage Select a valid choice. "empty string" is not one of the available choices.
67
- */
68
- public function testValidateChoiceEmpty ()
69
- {
70
- $ field = new ChoiceField (["choices " => array ("option1 " => "Option1 " )]);
71
- $ field ->validate ("" );
72
- }
73
-
74
64
public function testValidateValidValue ()
75
65
{
76
66
$ this ->assertNull ($ this ->field ->validate ("option1 " ));
You can’t perform that action at this time.
0 commit comments