Annotation of embedaddon/php/ext/fileinfo/tests/finfo_buffer_basic.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() : basic functionality ***\n";
30:
31: foreach( $options as $option ) {
32: $finfo = finfo_open( $option, $magicFile );
33: foreach( $buffers as $string ) {
34: var_dump( finfo_buffer( $finfo, $string, $option ) );
35: }
36: finfo_close( $finfo );
37: }
38:
39: ?>
40: ===DONE===
41: --EXPECTF--
42: *** Testing finfo_buffer() : basic functionality ***
43: string(36) "ASCII text, with no line terminators"
44: string(3) "ELF"
45: string(22) "old ACE/gr binary file"
46: string(12) "xo65 object,"
47: string(15) "MIFF image data"
48: string(25) "RIFF (little-endian) data"
49: string(28) "text/plain; charset=us-ascii"
50: string(26) "text/plain; charset=ebcdic"
51: string(40) "application/octet-stream; charset=binary"
52: string(28) "text/plain; charset=us-ascii"
53: string(28) "text/plain; charset=us-ascii"
54: string(25) "text/plain; charset=utf-8"
55: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>