1--TEST--
2Test filegroup() function: basic functionality
3--SKIPIF--
4<?php
5if( substr(PHP_OS, 0, 3) == 'WIN') {
6  die('skip Not valid for Windows');
7}
8?>
9--FILE--
10<?php
11/* Prototype: int filegroup ( string $filename )
12 * Description: Returns the group ID of the file, or FALSE in case of an error.
13 */
14
15echo "*** Testing filegroup(): basic functionality ***\n";
16
17echo "-- Testing with the file or directory created by owner --\n";
18
19$file_path = __DIR__;
20var_dump( filegroup(__FILE__) );
21var_dump( filegroup(".") );
22var_dump( filegroup("./..") );
23
24/* Newly created files and dirs */
25$file_name = $file_path."/filegroup_basic.tmp";
26$file_handle = fopen($file_name, "w");
27
28$string = "Hello, world\n1234\n123Hello";
29fwrite($file_handle, $string);
30var_dump( filegroup($file_name) );
31fclose($file_handle);
32
33$dir_name = $file_path."/filegroup_basic";
34mkdir($dir_name);
35var_dump( filegroup($dir_name) );
36
37echo "\n-- Testing with the standard file or directory --\n";
38var_dump( filegroup("/etc/passwd") );
39var_dump( filegroup("/etc") );
40var_dump( filegroup("/") );
41
42echo "\n*** Done ***\n";
43?>
44--CLEAN--
45<?php
46
47$file_path = __DIR__;
48$file_name = $file_path."/filegroup_basic.tmp";
49$dir_name  = $file_path."/filegroup_basic";
50unlink($file_name);
51rmdir($dir_name);
52?>
53--EXPECTF--
54*** Testing filegroup(): basic functionality ***
55-- Testing with the file or directory created by owner --
56int(%d)
57int(%d)
58int(%d)
59int(%d)
60int(%d)
61
62-- Testing with the standard file or directory --
63int(%d)
64int(%d)
65int(%d)
66
67*** Done ***
68