Skip to content

Commit 207f8a5

Browse files
authored
Merge pull request #183 from aik099/setvalue-checkbox-validation-feat
Throw exception, when doing a "setValue" call on checkbox with a non-boolean value
2 parents 7a74a76 + 0fbf050 commit 207f8a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/BrowserKitDriver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ public function setValue(string $xpath, $value)
413413
throw new DriverException('Only string values can be used for a radio input.');
414414
}
415415

416+
if (!\is_bool($value) && $field->getType() === 'checkbox') {
417+
throw new DriverException('Only boolean values can be used for a checkbox input.');
418+
}
419+
416420
if (\is_bool($value) && $field->getType() === 'select') {
417421
throw new DriverException('Boolean values cannot be used for a select element.');
418422
}

0 commit comments

Comments
 (0)