Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 9610eb4

Browse files
committed
[#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.
1 parent 1b9c62e commit 9610eb4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/Controller/Plugin/FilePostRedirectGetTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,14 @@ public function testCorrectInputDataMerging()
402402

403403
$messages = $form->getMessages();
404404
$this->assertTrue(isset($messages['collection'][1]['text'][NotEmpty::IS_EMPTY]));
405-
$this->assertTrue(isset($messages['collection'][1]['file'][NotEmpty::IS_EMPTY]));
405+
406+
$requiredFound = false;
407+
foreach ($messages['collection'][1]['file'] as $message) {
408+
if (strpos($message, 'Value is required') === 0) {
409+
$requiredFound = true;
410+
break;
411+
}
412+
}
413+
$this->assertTrue($requiredFound, '"Required" message was not found in validation failure messages');
406414
}
407415
}

0 commit comments

Comments
 (0)