xref: /PHP-8.3/ext/posix/tests/posix_getgrgid.phpt (revision 74859783)
1--TEST--
2Test posix_getgrgid().
3--CREDITS--
4Till Klampaeckel, till@php.net
5TestFest Berlin 2009
6--EXTENSIONS--
7posix
8--FILE--
9<?php
10$grp = posix_getgrgid(0);
11if (!isset($grp['name'])) {
12    die('Array index "name" does not exist.');
13}
14if (!isset($grp['passwd'])) {
15    die('Array index "passwd" does not exist.');
16}
17if (!isset($grp['members'])) {
18    die('Array index "members" does not exist.');
19} elseif (!is_array($grp['members'])) {
20    die('Array index "members" must be an array.');
21} else {
22    if (count($grp['members']) > 0) {
23        foreach ($grp['members'] as $idx => $username) {
24            if (!is_int($idx)) {
25                die('Index in members Array is not an int.');
26            }
27            if (!is_string($username)) {
28                die('Username in members Array is not of type string.');
29            }
30        }
31    }
32}
33if (!isset($grp['gid'])) {
34    die('Array index "gid" does not exist.');
35}
36var_dump($grp['gid']);
37?>
38--EXPECT--
39int(0)
40