Skip to content

Commit

Permalink
[BridgeImplementationTest] Add test for "required" attribute on lists…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
logmanoriginal committed Jan 22, 2019
1 parent 434c126 commit d532d0e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/BridgeImplementationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand Down

0 comments on commit d532d0e

Please sign in to comment.