File tree Expand file tree Collapse file tree 3 files changed +2
-12
lines changed Expand file tree Collapse file tree 3 files changed +2
-12
lines changed Original file line number Diff line number Diff line change 2323 "twig/twig" : " >=1.35"
2424 },
2525 "require-dev" : {
26- "phpunit/phpunit" : " ~6.0" ,
2726 "php-coveralls/php-coveralls" : " ^1.0" ,
27+ "phpunit/phpunit" : " ^6.5" ,
2828 "squizlabs/php_codesniffer" : " *"
2929 },
3030 "autoload" : {
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public function validate($value)
4141 {
4242 parent ::validate ($ value );
4343
44- if (!$ this ->validValue ($ value )) {
44+ if (!$ this ->isEmpty ( $ value ) && ! $ this -> validValue ($ value )) {
4545 if (is_array ($ value )) {
4646 $ value_diff = array_diff ($ value , array_keys ($ this ->choices ));
4747 $ value = implode (', ' , $ value_diff );
Original file line number Diff line number Diff line change @@ -61,16 +61,6 @@ public function testValidateChoiceUnexistent()
6161 $ this ->field ->validate ("option2 " );
6262 }
6363
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-
7464 public function testValidateValidValue ()
7565 {
7666 $ this ->assertNull ($ this ->field ->validate ("option1 " ));
You can’t perform that action at this time.
0 commit comments