com php-src: Test for function posix_getpwnam() basic functionality: ext/posix/tests/posix_getpwnam_basic _01.phpt
| From: | Peter Kokot | Date: | Fri, 01 Mar 2019 01:01:52 +0000 |
| Subject: | com php-src: Test for function posix_getpwnam() basic functionality: ext/posix/tests/posix_getpwnam_basic _01.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104918@lists.php.net to get a copy of this message | ||
Commit: 54ef8d13d8c91f2bdd3c9a65871918efad370571
Author: Rodrigo Prado <royopa@gmail.com> Fri, 1 Mar 2019 02:01:52 +0100
Committer: Peter Kokot <peterkokot@gmail.com> Fri, 1 Mar 2019 02:01:52 +0100
Parents: e763cc742505cbb4e85d161f5457bf711f85bd43
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=54ef8d13d8c91f2bdd3c9a65871918efad370571
Log:
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
Bugs:
https://bugs.php.net/1182
Changed paths:
M ext/posix/tests/posix_getpwnam_basic_01.phpt
Diff:
diff --git a/ext/posix/tests/posix_getpwnam_basic_01.phpt
b/ext/posix/tests/posix_getpwnam_basic_01.phpt
index 97bb159...23604b6 100644
--- a/ext/posix/tests/posix_getpwnam_basic_01.phpt
+++ b/ext/posix/tests/posix_getpwnam_basic_01.phpt
@@ -1,17 +1,23 @@
--TEST--
-Test posix_getpwnam() function : basic functionality
+Test posix_getpwnam() function : basic functionality
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
User Group: PHPSP #phptestfestbrasil
--SKIPIF--
-<?php
- if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
?>
--FILE--
-<?php
+<?php
$uid = posix_geteuid();
$user = posix_getpwuid($uid);
- print_r(posix_getpwnam($user['name']));
+ $username = $user['name'];
+ if (posix_getlogin() == false) {
+ $username = false;
+ }
+ $info = posix_getpwnam($username);
+ print_r($info);
+ var_dump($username == $info['name']);
?>
===DONE====
--EXPECTREGEX--
@@ -25,4 +31,5 @@ Array
\[dir\] => [^\r\n]+
\[shell\] => [^\r\n]+
\)
+bool\(true\)
===DONE====