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 = dirname(__FILE__);
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
45--CLEAN--
46<?php
47
48$file_path = dirname(__FILE__);
49$file_name = $file_path."/filegroup_basic.tmp";
50$dir_name  = $file_path."/filegroup_basic";
51unlink($file_name);
52rmdir($dir_name);
53?>
54
55--EXPECTF--
56*** Testing filegroup(): basic functionality ***
57-- Testing with the file or directory created by owner --
58int(%d)
59int(%d)
60int(%d)
61int(%d)
62int(%d)
63
64-- Testing with the standard file or directory --
65int(%d)
66int(%d)
67int(%d)
68
69*** Done ***
70