Skip to content

Commit 0fbf050

Browse files
committed
Throw exception, when doing a "setValue" call on checkbox with a non-boolean value
1 parent 7a74a76 commit 0fbf050

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/BrowserKitDriver.php

+4
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)