This repository was archived by the owner on Jan 30, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,39 @@ public function testRequiredWithoutFallbackAndValueNotSetProvidesNotEmptyValidat
220220 $ this ->assertRequiredValidationErrorMessage ($ input );
221221 }
222222
223+ /**
224+ * @group 28
225+ * @group 69
226+ */
227+ public function testRequiredWithoutFallbackAndValueNotSetProvidesAttachedNotEmptyValidatorIsEmptyErrorMessage ()
228+ {
229+ $ input = new Input ();
230+ $ input ->setRequired (true );
231+
232+ $ customMessage = [
233+ NotEmptyValidator::IS_EMPTY => "Custom message " ,
234+ ];
235+
236+ $ notEmpty = $ this ->getMockBuilder (NotEmptyValidator::class)
237+ ->setMethods (['getOption ' ])
238+ ->getMock ();
239+
240+ $ notEmpty ->expects ($ this ->once ())
241+ ->method ('getOption ' )
242+ ->with ('messageTemplates ' )
243+ ->willReturn ($ customMessage );
244+
245+ $ input ->getValidatorChain ()
246+ ->attach ($ notEmpty );
247+
248+ $ this ->assertFalse (
249+ $ input ->isValid (),
250+ 'isValid() should always return false when no fallback value is present, '
251+ . 'the input is required, and no data is set. '
252+ );
253+ $ this ->assertEquals ($ customMessage , $ input ->getMessages ());
254+ }
255+
223256 /**
224257 * @group 28
225258 * @group 60
You can’t perform that action at this time.
0 commit comments