summaryrefslogtreecommitdiff
path: root/ext/bcmath/tests/bcadd_error.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bcmath/tests/bcadd_error.phpt')
-rw-r--r--ext/bcmath/tests/bcadd_error.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/bcmath/tests/bcadd_error.phpt b/ext/bcmath/tests/bcadd_error.phpt
new file mode 100644
index 0000000000..adb6c3cdc3
--- /dev/null
+++ b/ext/bcmath/tests/bcadd_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+bcadd() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcadd('a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcadd('1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcadd(): Argument #1 ($num1) is not well-formed
+bcadd(): Argument #2 ($num2) is not well-formed