From: andy wharmby Date: Mon, 19 Jan 2009 17:13:17 +0000 (+0000) Subject: New substr_replace() and unpack() error tests. Tested on Windows, Linux and Linux... X-Git-Tag: php-5.4.0alpha1~191^2~4463 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fb370c1ffc22adc01d342d71b359711db8185cf;p=php New substr_replace() and unpack() error tests. Tested on Windows, Linux and Linux 64 bit. --- diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt new file mode 100644 index 0000000000..bbef29c7c6 --- /dev/null +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test substr_replace() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing substr_replace() : error conditions *** + +-- Testing substr_replace() function with less than expected no. of arguments -- + +Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d +NULL + +Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d +NULL + +-- Testing substr_replace() function with more than expected no. of arguments -- + +Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing substr_replace() function with start and length different types -- + +Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d +unicode(12) "Good morning" + +Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d +unicode(12) "Good morning" + +-- Testing substr_replace() function with start and length with a different number of elments -- + +Warning: substr_replace(): 'from' and 'len' should have the same number of elements in %s on line %d +unicode(12) "Good morning" + +-- Testing substr_replace() function with start and length as arrays but string not-- + +Warning: substr_replace(): Functionality of 'from' and 'len' as arrays is not implemented in %s on line %d +unicode(12) "Good morning" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt new file mode 100644 index 0000000000..43b2df1c0a --- /dev/null +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test unpack() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing unpack() : error conditions *** + +-- Testing unpack() function with no arguments -- + +Warning: unpack() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +-- Testing unpack() function with more than expected no. of arguments -- + +Warning: unpack() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing unpack() function with invalid format character -- + +Warning: unpack(): Invalid format type Z in %s on line %d +bool(false) +===DONE===