From d532d0e0c4033d4b5f9de323e5d36bda61ffbc43 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Tue, 22 Jan 2019 18:12:34 +0100 Subject: [PATCH] [BridgeImplementationTest] Add test for "required" attribute on lists and checkboxes Lists and checkboxes don't support the "required" flag and should not define it. Note that the "required" flag can be set to false if so desired. --- tests/BridgeImplementationTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/BridgeImplementationTest.php b/tests/BridgeImplementationTest.php index 51642fa963f..9b74f20e51b 100644 --- a/tests/BridgeImplementationTest.php +++ b/tests/BridgeImplementationTest.php @@ -98,6 +98,19 @@ public function testParameters($path) { if (isset($options['required'])) { $this->assertInternalType('bool', $options['required'], $field . ': invalid required'); + + if($options['required'] === true && isset($options['type'])) { + switch($options['type']) { + case 'list': + case 'checkbox': + $this->assertArrayNotHasKey( + 'required', + $options, + $field . ': "required" attribute not supported for ' . $options['type'] + ); + break; + } + } } if (isset($options['title'])) {