Annotation of embedaddon/php/ext/standard/tests/file/fnmatch_error.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test fnmatch() function: Error conditions
                      3: --SKIPIF--
                      4: <?php
                      5: if (!function_exists('fnmatch'))
                      6:     die("skip fnmatch() function is not available");
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: /* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
                     11:    Description: fnmatch() checks if the passed string would match 
                     12:      the given shell wildcard pattern. 
                     13: */
                     14: 
                     15: echo "*** Testing error conditions for fnmatch() ***";
                     16: 
                     17: /* Invalid arguments */
                     18: var_dump( fnmatch(array(), array()) );
                     19: 
                     20: $file_handle = fopen(__FILE__, "r");
                     21: var_dump( fnmatch($file_handle, $file_handle) );
                     22: fclose( $file_handle );
                     23: 
                     24: $std_obj = new stdClass();
                     25: var_dump( fnmatch($std_obj, $std_obj) );
                     26: 
                     27: 
                     28: /* No.of arguments less than expected */
                     29: var_dump( fnmatch("match.txt") );
                     30: var_dump( fnmatch("") );
                     31: 
                     32: /* No.of arguments greater than expected */
                     33: var_dump( fnmatch("match.txt", "match.txt", TRUE, 100) );
                     34: 
                     35: echo "\n*** Done ***\n";
                     36: ?>
                     37: --EXPECTF--
                     38: *** Testing error conditions for fnmatch() ***
1.1.1.2 ! misho      39: Warning: fnmatch() expects parameter 1 to be a valid path, array given in %s on line %d
1.1       misho      40: NULL
                     41: 
1.1.1.2 ! misho      42: Warning: fnmatch() expects parameter 1 to be a valid path, resource given in %s on line %d
1.1       misho      43: NULL
                     44: 
1.1.1.2 ! misho      45: Warning: fnmatch() expects parameter 1 to be a valid path, object given in %s on line %d
1.1       misho      46: NULL
                     47: 
                     48: Warning: fnmatch() expects at least 2 parameters, 1 given in %s on line %d%d
                     49: NULL
                     50: 
                     51: Warning: fnmatch() expects at least 2 parameters, 1 given in %s on line %d%d
                     52: NULL
                     53: 
                     54: Warning: fnmatch() expects at most 3 parameters, 4 given in %s on line %d%d
                     55: NULL
                     56: 
                     57: *** Done ***

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>