Annotation of embedaddon/php/ext/fileinfo/tests/finfo_buffer_error.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test finfo_buffer() function : error conditions 
        !             3: --SKIPIF--
        !             4: <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
        !             5: --FILE--
        !             6: <?php
        !             7: /* Prototype  : string finfo_buffer(resource finfo, char *string [, int options [, resource context]])
        !             8:  * Description: Return infromation about a string buffer. 
        !             9:  * Source code: ext/fileinfo/fileinfo.c
        !            10:  * Alias to functions: 
        !            11:  */
        !            12: 
        !            13: $magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
        !            14: 
        !            15: echo "*** Testing finfo_buffer() : error conditions ***\n";
        !            16: 
        !            17: $finfo = finfo_open( FILEINFO_NONE, $magicFile );
        !            18: 
        !            19: //Test finfo_buffer with one more than the expected number of arguments
        !            20: echo "\n-- Testing finfo_buffer() function with more than expected no. of arguments --\n";
        !            21: 
        !            22: $context = stream_context_get_default();
        !            23: $extra_arg = 10;
        !            24: var_dump( finfo_buffer($finfo, "foobar", FILEINFO_MIME, $context, $extra_arg) );
        !            25: 
        !            26: // Testing finfo_buffer with one less than the expected number of arguments
        !            27: echo "\n-- Testing finfo_buffer() function with less than expected no. of arguments --\n";
        !            28: 
        !            29: var_dump( finfo_buffer($finfo) );
        !            30: 
        !            31: ?>
        !            32: ===DONE===
        !            33: --EXPECTF--
        !            34: *** Testing finfo_buffer() : error conditions ***
        !            35: 
        !            36: -- Testing finfo_buffer() function with more than expected no. of arguments --
        !            37: 
        !            38: Warning: finfo_buffer() expects at most 4 parameters, 5 given in %s on line %d
        !            39: bool(false)
        !            40: 
        !            41: -- Testing finfo_buffer() function with less than expected no. of arguments --
        !            42: 
        !            43: Warning: finfo_buffer() expects at least 2 parameters, 1 given in %s on line %d
        !            44: bool(false)
        !            45: ===DONE===

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