From 9610eb4f94cafd05bfa7b920b6783ef0e5889fcb Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 11 Aug 2015 13:14:41 -0500 Subject: [PATCH] [#21] Fix failing unit test zendframework/zend-inputfilter#7 introduced a minor change in how required elements are handled in specific cases, and this results in a change in how the "Value is required" validation message is injected into validation failures. This patch makes the test more robust in searching for that message. --- test/Controller/Plugin/FilePostRedirectGetTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/Controller/Plugin/FilePostRedirectGetTest.php b/test/Controller/Plugin/FilePostRedirectGetTest.php index 0351009fa..da8677683 100644 --- a/test/Controller/Plugin/FilePostRedirectGetTest.php +++ b/test/Controller/Plugin/FilePostRedirectGetTest.php @@ -402,6 +402,14 @@ public function testCorrectInputDataMerging() $messages = $form->getMessages(); $this->assertTrue(isset($messages['collection'][1]['text'][NotEmpty::IS_EMPTY])); - $this->assertTrue(isset($messages['collection'][1]['file'][NotEmpty::IS_EMPTY])); + + $requiredFound = false; + foreach ($messages['collection'][1]['file'] as $message) { + if (strpos($message, 'Value is required') === 0) { + $requiredFound = true; + break; + } + } + $this->assertTrue($requiredFound, '"Required" message was not found in validation failure messages'); } }