Skip to content

Commit 54ef8d1

Browse files
royopapetk
authored andcommitted
Test for function posix_getpwnam() basic functionality
The coverage for the function posix_getpwnam() that was not covered yet. http://gcov.php.net/PHP_HEAD/lcov_html/ext/posix/posix.c.gcov.php#1182 Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> User Group: PHPSP #PHPTestFestBrasil
1 parent e763cc7 commit 54ef8d1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

ext/posix/tests/posix_getpwnam_basic_01.phpt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
--TEST--
2-
Test posix_getpwnam() function : basic functionality
2+
Test posix_getpwnam() function : basic functionality
33
--CREDITS--
44
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
55
User Group: PHPSP #phptestfestbrasil
66
--SKIPIF--
7-
<?php
8-
if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
7+
<?php
8+
if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
99
?>
1010
--FILE--
11-
<?php
11+
<?php
1212
$uid = posix_geteuid();
1313
$user = posix_getpwuid($uid);
14-
print_r(posix_getpwnam($user['name']));
14+
$username = $user['name'];
15+
if (posix_getlogin() == false) {
16+
$username = false;
17+
}
18+
$info = posix_getpwnam($username);
19+
print_r($info);
20+
var_dump($username == $info['name']);
1521
?>
1622
===DONE====
1723
--EXPECTREGEX--
@@ -25,4 +31,5 @@ Array
2531
\[dir\] => [^\r\n]+
2632
\[shell\] => [^\r\n]+
2733
\)
34+
bool\(true\)
2835
===DONE====

0 commit comments

Comments
 (0)