Annotation of embedaddon/php/ext/fileinfo/tests/finfo_buffer_variation1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test finfo_buffer() function : basic functionality 
                      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: $options = array(
                     16:        FILEINFO_NONE,
                     17:        FILEINFO_MIME,
                     18: );
                     19: 
                     20: $buffers = array(
                     21:        "Regular string here",
                     22:        "\177ELF",
                     23:        "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
                     24:        "\x55\x7A\x6E\x61",
                     25:        "id=ImageMagick",
                     26:        "RIFFüîò^BAVI LISTv",
                     27: );
                     28: 
                     29: echo "*** Testing finfo_buffer() : variation functionality with oo interface ***\n";
                     30: 
                     31: foreach( $options as $option ) {
                     32:        $finfo = new finfo( $option, $magicFile );
                     33:        foreach( $buffers as $string ) {
                     34:                var_dump( $finfo->buffer( $string, $option ) );
                     35:        }
                     36: }
                     37: 
                     38: ?>
                     39: ===DONE===
                     40: --EXPECTF--
                     41: *** Testing finfo_buffer() : variation functionality with oo interface ***
                     42: string(36) "ASCII text, with no line terminators"
                     43: string(3) "ELF"
                     44: string(22) "old ACE/gr binary file"
                     45: string(12) "xo65 object,"
                     46: string(15) "MIFF image data"
                     47: string(25) "RIFF (little-endian) data"
                     48: string(28) "text/plain; charset=us-ascii"
                     49: string(26) "text/plain; charset=ebcdic"
                     50: string(40) "application/octet-stream; charset=binary"
                     51: string(28) "text/plain; charset=us-ascii"
                     52: string(28) "text/plain; charset=us-ascii"
                     53: string(25) "text/plain; charset=utf-8"
                     54: ===DONE===

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