strcspn_error.phpt [plain text]
--TEST--
Test strcspn() function : error conditions
--FILE--
<?php
echo "*** Testing strcspn() : error conditions ***\n";
echo "\n-- Testing strcspn() function with Zero arguments --\n";
var_dump( strcspn() );
echo "\n-- Testing strcspn() function with more than expected no. of arguments --\n";
$str = 'string_val';
$mask = 'string_val';
$start = 2;
$len = 20;
$extra_arg = 10;
var_dump( strcspn($str,$mask,$start,$len, $extra_arg) );
echo "\n-- Testing strcspn() function with less than expected no. of arguments --\n";
$str = 'string_val';
var_dump( strcspn($str) );
echo "Done"
?>
--EXPECTF--
*** Testing strcspn() : error conditions ***
-- Testing strcspn() function with Zero arguments --
Warning: strcspn() expects at least 2 parameters, 0 given in %s on line %d
NULL
-- Testing strcspn() function with more than expected no. of arguments --
Warning: strcspn() expects at most 4 parameters, 5 given in %s on line %d
NULL
-- Testing strcspn() function with less than expected no. of arguments --
Warning: strcspn() expects at least 2 parameters, 1 given in %s on line %d
NULL
Done