1--TEST--
2Test strncasecmp() function : error conditions
3--FILE--
4<?php
5/* Prototype  : int strncasecmp ( string $str1, string $str2, int $len );
6 * Description: Binary safe case-insensitive string comparison of the first n characters
7 * Source code: Zend/zend_builtin_functions.c
8*/
9
10echo "*** Testing strncasecmp() function: error conditions ***\n";
11$str1 = 'string_val';
12$str2 = 'string_val';
13$len = 10;
14$extra_arg = 10;
15
16echo "\n-- Testing strncasecmp() function with Zero arguments --";
17var_dump( strncasecmp() );
18
19echo "\n-- Testing strncasecmp() function with less than expected number of arguments --";
20var_dump( strncasecmp($str1) );
21var_dump( strncasecmp($str1, $str2) );
22
23echo "\n-- Testing strncasecmp() function with more than expected number of arguments --";
24var_dump( strncasecmp($str1, $str2, $len, $extra_arg) );
25
26echo "\n-- Testing strncasecmp() function with invalid argument --";
27$len = -10;
28var_dump( strncasecmp($str1, $str2, $len) );
29echo "*** Done ***\n";
30?>
31--EXPECTF--
32*** Testing strncasecmp() function: error conditions ***
33
34-- Testing strncasecmp() function with Zero arguments --
35Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d
36NULL
37
38-- Testing strncasecmp() function with less than expected number of arguments --
39Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d
40NULL
41
42Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d
43NULL
44
45-- Testing strncasecmp() function with more than expected number of arguments --
46Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d
47NULL
48
49-- Testing strncasecmp() function with invalid argument --
50Warning: Length must be greater than or equal to 0 in %s on line %d
51bool(false)
52*** Done ***
53