summaryrefslogtreecommitdiff
path: root/ext/posix/tests
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/posix/tests
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/posix/tests')
-rw-r--r--ext/posix/tests/001.phpt12
-rw-r--r--ext/posix/tests/posix_access.phpt52
-rw-r--r--ext/posix/tests/posix_access_error_modes.phpt46
-rw-r--r--ext/posix/tests/posix_access_error_wrongparams.phpt44
-rw-r--r--ext/posix/tests/posix_access_safemode.phpt25
-rw-r--r--ext/posix/tests/posix_ctermid.phpt26
-rw-r--r--ext/posix/tests/posix_ctermid_basic.phpt18
-rw-r--r--ext/posix/tests/posix_ctermid_error.phpt19
-rw-r--r--ext/posix/tests/posix_errno_basic.phpt22
-rw-r--r--ext/posix/tests/posix_errno_error.phpt24
-rw-r--r--ext/posix/tests/posix_errno_variation1.phpt23
-rw-r--r--ext/posix/tests/posix_errno_variation2.phpt30
-rw-r--r--ext/posix/tests/posix_get_last_error_error.phpt31
-rw-r--r--ext/posix/tests/posix_getcwd.phpt19
-rw-r--r--ext/posix/tests/posix_getcwd_basic.phpt22
-rw-r--r--ext/posix/tests/posix_getegid_basic.phpt15
-rw-r--r--ext/posix/tests/posix_geteuid_basic.phpt16
-rw-r--r--ext/posix/tests/posix_geteuid_error1.phpt37
-rw-r--r--ext/posix/tests/posix_getgid_error.phpt31
-rw-r--r--ext/posix/tests/posix_getgrgid.phpt45
-rw-r--r--ext/posix/tests/posix_getgrgid_basic.phpt30
-rw-r--r--ext/posix/tests/posix_getgrgid_error.phpt49
-rw-r--r--ext/posix/tests/posix_getgrgid_macosx.phpt23
-rw-r--r--ext/posix/tests/posix_getgrgid_variation.phpt185
-rw-r--r--ext/posix/tests/posix_getgrgid_wrongparams.phpt28
-rw-r--r--ext/posix/tests/posix_getgrnam.phpt19
-rw-r--r--ext/posix/tests/posix_getgrnam_basic.phpt23
-rw-r--r--ext/posix/tests/posix_getgroups_basic.phpt24
-rw-r--r--ext/posix/tests/posix_getpgid_basic.phpt23
-rw-r--r--ext/posix/tests/posix_getpgid_error.phpt48
-rw-r--r--ext/posix/tests/posix_getpgid_variation.phpt185
-rw-r--r--ext/posix/tests/posix_getpgrp_basic.phpt21
-rw-r--r--ext/posix/tests/posix_getpgrp_error.phpt31
-rw-r--r--ext/posix/tests/posix_getpid_basic.phpt21
-rw-r--r--ext/posix/tests/posix_getpid_error.phpt31
-rw-r--r--ext/posix/tests/posix_getppid_basic.phpt21
-rw-r--r--ext/posix/tests/posix_getppid_error.phpt31
-rw-r--r--ext/posix/tests/posix_getpwnam.phpt19
-rw-r--r--ext/posix/tests/posix_getpwnam_basic.phpt23
-rw-r--r--ext/posix/tests/posix_getpwuid_basic.phpt30
-rw-r--r--ext/posix/tests/posix_getpwuid_error.phpt46
-rw-r--r--ext/posix/tests/posix_getpwuid_variation.phpt185
-rw-r--r--ext/posix/tests/posix_getrlimit.phpt17
-rw-r--r--ext/posix/tests/posix_getrlimit_basic.phpt20
-rw-r--r--ext/posix/tests/posix_getsid.phpt28
-rw-r--r--ext/posix/tests/posix_getsid_basic.phpt22
-rw-r--r--ext/posix/tests/posix_getsid_error.phpt28
-rw-r--r--ext/posix/tests/posix_getuid_error.phpt31
-rw-r--r--ext/posix/tests/posix_initgroups.phpt18
-rw-r--r--ext/posix/tests/posix_initgroups_basic.phpt22
-rw-r--r--ext/posix/tests/posix_isatty.phpt15
-rw-r--r--ext/posix/tests/posix_kill_basic.phpt39
-rw-r--r--ext/posix/tests/posix_kill_error.phpt59
-rw-r--r--ext/posix/tests/posix_kill_variation1.phpt179
-rw-r--r--ext/posix/tests/posix_kill_variation2.phpt179
-rw-r--r--ext/posix/tests/posix_mkfifo_safemode.phpt45
-rw-r--r--ext/posix/tests/posix_mkfifo_wrongparams.phpt21
-rw-r--r--ext/posix/tests/posix_mknod.phpt15
-rw-r--r--ext/posix/tests/posix_mknod_basic.phpt18
-rw-r--r--ext/posix/tests/posix_seteuid_basic.phpt19
-rw-r--r--ext/posix/tests/posix_seteuid_error.phpt32
-rw-r--r--ext/posix/tests/posix_seteuid_error2.phpt55
-rw-r--r--ext/posix/tests/posix_seteuid_variation1.phpt41
-rw-r--r--ext/posix/tests/posix_seteuid_variation2.phpt37
-rw-r--r--ext/posix/tests/posix_seteuid_variation3.phpt48
-rw-r--r--ext/posix/tests/posix_seteuid_variation4.phpt41
-rw-r--r--ext/posix/tests/posix_seteuid_variation5.phpt35
-rw-r--r--ext/posix/tests/posix_seteuid_variation6.phpt48
-rw-r--r--ext/posix/tests/posix_setgid_basic.phpt27
-rw-r--r--ext/posix/tests/posix_setgid_error.phpt32
-rw-r--r--ext/posix/tests/posix_setgid_variation1.phpt47
-rw-r--r--ext/posix/tests/posix_setgid_variation2.phpt40
-rw-r--r--ext/posix/tests/posix_setgid_variation3.phpt48
-rw-r--r--ext/posix/tests/posix_setgid_variation4.phpt42
-rw-r--r--ext/posix/tests/posix_setgid_variation5.phpt38
-rw-r--r--ext/posix/tests/posix_setgid_variation6.phpt58
-rw-r--r--ext/posix/tests/posix_setgid_variation7.phpt48
-rw-r--r--ext/posix/tests/posix_setuid_basic.phpt19
-rw-r--r--ext/posix/tests/posix_setuid_error.phpt35
-rw-r--r--ext/posix/tests/posix_setuid_error2.phpt55
-rw-r--r--ext/posix/tests/posix_setuid_variation1.phpt41
-rw-r--r--ext/posix/tests/posix_setuid_variation2.phpt37
-rw-r--r--ext/posix/tests/posix_setuid_variation3.phpt48
-rw-r--r--ext/posix/tests/posix_setuid_variation4.phpt41
-rw-r--r--ext/posix/tests/posix_setuid_variation5.phpt35
-rw-r--r--ext/posix/tests/posix_setuid_variation6.phpt48
-rw-r--r--ext/posix/tests/posix_strerror_error.phpt46
-rw-r--r--ext/posix/tests/posix_strerror_variation1.phpt178
-rw-r--r--ext/posix/tests/posix_times.phpt33
-rw-r--r--ext/posix/tests/posix_times_basic.phpt37
-rw-r--r--ext/posix/tests/posix_times_error.phpt31
-rw-r--r--ext/posix/tests/posix_ttyname.phpt26
-rw-r--r--ext/posix/tests/posix_ttyname_error.phpt35
-rw-r--r--ext/posix/tests/posix_ttyname_error_wrongparams.phpt37
-rw-r--r--ext/posix/tests/posix_ttyname_variation1.phpt41
-rw-r--r--ext/posix/tests/posix_ttyname_variation2.phpt38
-rw-r--r--ext/posix/tests/posix_ttyname_variation3.phpt45
-rw-r--r--ext/posix/tests/posix_ttyname_variation4.phpt40
-rw-r--r--ext/posix/tests/posix_ttyname_variation5.phpt34
-rw-r--r--ext/posix/tests/posix_ttyname_variation6.phpt57
-rw-r--r--ext/posix/tests/posix_ttyname_variation7.phpt42
-rw-r--r--ext/posix/tests/posix_uname_basic.phpt28
-rw-r--r--ext/posix/tests/posix_uname_error.phpt31
103 files changed, 4283 insertions, 0 deletions
diff --git a/ext/posix/tests/001.phpt b/ext/posix/tests/001.phpt
new file mode 100644
index 0000000..e6c629c
--- /dev/null
+++ b/ext/posix/tests/001.phpt
@@ -0,0 +1,12 @@
+--TEST--
+posix_access() with bogus paths
+--SKIPIF--
+<?php if (!extension_loaded('posix')) echo 'skip'; ?>
+--FILE--
+<?php
+
+var_dump(posix_access(str_repeat('bogus path', 1042)));
+
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/posix/tests/posix_access.phpt b/ext/posix/tests/posix_access.phpt
new file mode 100644
index 0000000..47b5e15
--- /dev/null
+++ b/ext/posix/tests/posix_access.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test posix_access() function test
+--DESCRIPTION--
+checks for existence, read-access, write-access, execute-access
+--CREDITS--
+Moritz Neuhaeuser, info@xcompile.net
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+if (posix_geteuid() == 0) {
+ die('SKIP Cannot run test as root.');
+}
+if (PHP_VERSION_ID < 503099) {
+ die('SKIP Safe mode is no longer available.');
+}
+?>
+--FILE--
+<?php
+$filename = dirname(__FILE__) . '/foo.test';
+$fp = fopen($filename,"w");
+fwrite($fp,"foo");
+fclose($fp);
+
+chmod ($filename, 0000);
+var_dump(posix_access($filename, POSIX_F_OK));
+
+chmod ($filename, 0400);
+var_dump(posix_access($filename, POSIX_R_OK));
+
+chmod ($filename, 0600);
+var_dump(posix_access($filename, POSIX_W_OK));
+
+chmod ($filename, 0700);
+var_dump(posix_access($filename, POSIX_X_OK));
+?>
+===DONE===
+--CLEAN--
+<?php
+$filename = dirname(__FILE__) . '/foo.test';
+chmod ($filename, 0700);
+unlink($filename);
+?>
+--EXPECTF--
+Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+===DONE===
diff --git a/ext/posix/tests/posix_access_error_modes.phpt b/ext/posix/tests/posix_access_error_modes.phpt
new file mode 100644
index 0000000..fb04e34
--- /dev/null
+++ b/ext/posix/tests/posix_access_error_modes.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test posix_access() function test error conditions
+--DESCRIPTION--
+checks if posix_access() failes for wrong permissions
+--CREDITS--
+Moritz Neuhaeuser, info@xcompile.net
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+if (posix_geteuid() == 0) {
+ die('SKIP Cannot run test as root.');
+}
+if (PHP_VERSION_ID < 503099) {
+ die('SKIP Safe mode is no longer available.');
+}
+?>
+--FILE--
+<?php
+$filename = dirname(__FILE__) . '/foo.test';
+var_dump(posix_access($filename, POSIX_F_OK));
+$fp = fopen($filename,"w");
+fwrite($fp,"foo");
+fclose($fp);
+
+chmod ($filename, 0000);
+var_dump(posix_access($filename, POSIX_R_OK));
+var_dump(posix_access($filename, POSIX_W_OK));
+var_dump(posix_access($filename, POSIX_X_OK));
+?>
+===DONE===
+--CLEAN--
+<?php
+$filename = dirname(__FILE__) . '/foo.test';
+chmod ($filename, 0700);
+unlink($filename);
+?>
+--EXPECTF--
+WDeprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line %d
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_access_error_wrongparams.phpt b/ext/posix/tests/posix_access_error_wrongparams.phpt
new file mode 100644
index 0000000..35556a1
--- /dev/null
+++ b/ext/posix/tests/posix_access_error_wrongparams.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test posix_access() function : parameter validation
+--DESCRIPTION--
+cases: no params, wrong param1, wrong param2, null directory, wrong directory,
+--CREDITS--
+Moritz Neuhaeuser, info@xcompile.net
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+if (posix_geteuid() == 0) {
+ die('SKIP Cannot run test as root.');
+}
+if (PHP_VERSION_ID < 503099) {
+ die('SKIP Safe mode is no longer available.');
+}
+?>
+--FILE--
+<?php
+
+var_dump( posix_access() );
+var_dump( posix_access(array()) );
+var_dump( posix_access('foo',array()) );
+var_dump( posix_access(null) );
+
+var_dump(posix_access('./foobar'));
+?>
+===DONE===
+--EXPECTF--
+Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0
+
+Warning: posix_access() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: posix_access() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: posix_access() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_access_safemode.phpt b/ext/posix/tests/posix_access_safemode.phpt
new file mode 100644
index 0000000..b726b4f
--- /dev/null
+++ b/ext/posix/tests/posix_access_safemode.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test posix_access() with safe_mode enabled.
+--CREDITS--
+Till Klampaeckel, till@php.net
+TestFest Berlin 2009
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+if (posix_geteuid() == 0) {
+ die('SKIP Cannot run test as root.');
+}
+if (PHP_VERSION_ID < 503099) {
+ die('SKIP Safe mode is no longer available.');
+}
+--FILE--
+<?php
+var_dump(posix_access('/tmp', POSIX_W_OK));
+?>
+===DONE===
+--EXPECTF--
+Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_ctermid.phpt b/ext/posix/tests/posix_ctermid.phpt
new file mode 100644
index 0000000..f77da00
--- /dev/null
+++ b/ext/posix/tests/posix_ctermid.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test posix_ctermid()
+--DESCRIPTION--
+Gets path name of controlling terminal.
+Source code: ext/posix/posix.c
+--CREDITS--
+Falko Menge, mail at falko-menge dot de
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) {
+ die('SKIP - POSIX extension not available');
+ }
+ // needed because of #ifdef HAVE_CTERMID in posix.c
+ if (!function_exists('posix_ctermid')) {
+ die('SKIP - Fuction posix_ctermid() not available');
+ }
+?>
+--FILE--
+<?php
+ var_dump(posix_ctermid());
+?>
+===DONE===
+--EXPECTF--
+string(%d) "%s"
+===DONE===
diff --git a/ext/posix/tests/posix_ctermid_basic.phpt b/ext/posix/tests/posix_ctermid_basic.phpt
new file mode 100644
index 0000000..d1d4694
--- /dev/null
+++ b/ext/posix/tests/posix_ctermid_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test function posix_ctermid() by calling it with its expected arguments
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+
+var_dump( posix_ctermid() );
+
+?>
+--EXPECTF--
+string(%d) %s
diff --git a/ext/posix/tests/posix_ctermid_error.phpt b/ext/posix/tests/posix_ctermid_error.phpt
new file mode 100644
index 0000000..a177f54
--- /dev/null
+++ b/ext/posix/tests/posix_ctermid_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test function posix_ctermid() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+var_dump( posix_ctermid( 'foo' ) );
+
+?>
+--EXPECTF--
+Warning: posix_ctermid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
diff --git a/ext/posix/tests/posix_errno_basic.phpt b/ext/posix/tests/posix_errno_basic.phpt
new file mode 100644
index 0000000..cd94a97
--- /dev/null
+++ b/ext/posix/tests/posix_errno_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test function posix_errno() by calling it with its expected arguments
+--CREDITS--
+Morten Amundsen mor10am@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+
+echo "*** Test by calling method or function with its expected arguments ***\n";
+
+// test without any error
+var_dump(posix_errno());
+
+?>
+--EXPECTF--
+*** Test by calling method or function with its expected arguments ***
+int(0)
diff --git a/ext/posix/tests/posix_errno_error.phpt b/ext/posix/tests/posix_errno_error.phpt
new file mode 100644
index 0000000..0a77fb0
--- /dev/null
+++ b/ext/posix/tests/posix_errno_error.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test function posix_errno() by calling it with its expected arguments
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Morten Amundsen mor10am@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+echo "*** Test by calling method or function with more than expected arguments ***\n";
+
+// test without any error
+var_dump(posix_errno('bar'));
+
+?>
+--EXPECTF--
+*** Test by calling method or function with more than expected arguments ***
+
+Warning: posix_errno() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
diff --git a/ext/posix/tests/posix_errno_variation1.phpt b/ext/posix/tests/posix_errno_variation1.phpt
new file mode 100644
index 0000000..b57b7c0
--- /dev/null
+++ b/ext/posix/tests/posix_errno_variation1.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test function posix_errno() by calling it with with permission error
+--CREDITS--
+Morten Amundsen mor10am@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_getuid()==0) print "skip - Cannot run test as root.";
+?>
+--FILE--
+<?php
+
+echo "*** Test by calling function with permission error ***\n";
+
+posix_setuid(0);
+var_dump(posix_errno());
+
+?>
+--EXPECTF--
+*** Test by calling function with permission error ***
+int(1)
diff --git a/ext/posix/tests/posix_errno_variation2.phpt b/ext/posix/tests/posix_errno_variation2.phpt
new file mode 100644
index 0000000..ad3aa31
--- /dev/null
+++ b/ext/posix/tests/posix_errno_variation2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test function posix_errno() by calling it with its expected arguments
+--CREDITS--
+Morten Amundsen mor10am@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(!extension_loaded("pcntl")) print "skip - PCNTL extension required";
+?>
+--FILE--
+<?php
+
+echo "*** Test by calling function with pid error ***\n";
+
+$pid = 10000;
+
+do {
+ $pid += 1;
+ $result = shell_exec("ps -p " . $pid);
+} while (strstr($pid, $result));
+
+posix_kill($pid, SIGKILL);
+var_dump(posix_errno());
+
+?>
+--EXPECTF--
+*** Test by calling function with pid error ***
+int(3)
diff --git a/ext/posix/tests/posix_get_last_error_error.phpt b/ext/posix/tests/posix_get_last_error_error.phpt
new file mode 100644
index 0000000..6cf2161
--- /dev/null
+++ b/ext/posix/tests/posix_get_last_error_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_get_last_error() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_get_last_error(void)
+ * Description: Retrieve the error number set by the last posix function which failed.
+ * Source code: ext/posix/posix.c
+ * Alias to functions: posix_errno
+ */
+
+echo "*** Testing posix_get_last_error() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_get_last_error() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_get_last_error($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_get_last_error() : error conditions ***
+
+-- Testing posix_get_last_error() function with one argument --
+
+Warning: posix_get_last_error() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getcwd.phpt b/ext/posix/tests/posix_getcwd.phpt
new file mode 100644
index 0000000..75c8d57
--- /dev/null
+++ b/ext/posix/tests/posix_getcwd.phpt
@@ -0,0 +1,19 @@
+--TEST--
+posix_getcwd(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_getcwd')) die('skip posix_getcwd() not found');
+?>
+--FILE--
+<?php
+
+var_dump(posix_getcwd());
+var_dump(posix_getcwd(1));
+
+?>
+--EXPECTF--
+string(%d) "%s"
+
+Warning: posix_getcwd() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
diff --git a/ext/posix/tests/posix_getcwd_basic.phpt b/ext/posix/tests/posix_getcwd_basic.phpt
new file mode 100644
index 0000000..2477c37
--- /dev/null
+++ b/ext/posix/tests/posix_getcwd_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+posix_getcwd(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_getcwd')) die('skip posix_getcwd() not found');
+?>
+--FILE--
+<?php
+echo "Basic test of POSIX posix_getcwd function\n";
+var_dump(posix_getcwd());
+var_dump(posix_getcwd(1));
+
+?>
+===DONE===
+--EXPECTF--
+Basic test of POSIX posix_getcwd function
+string(%d) "%s"
+
+Warning: posix_getcwd() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/posix/tests/posix_getegid_basic.phpt b/ext/posix/tests/posix_getegid_basic.phpt
new file mode 100644
index 0000000..d0016f4
--- /dev/null
+++ b/ext/posix/tests/posix_getegid_basic.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Test function posix_getegid() by calling it with its expected arguments
+--CREDITS--
+Michelangelo van Dam dragonbe@gmail.com
+#PHPTestFest Dutch PHP Conference 2012
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+var_dump(posix_getegid());
+?>
+--EXPECTF--
+int(%d)
diff --git a/ext/posix/tests/posix_geteuid_basic.phpt b/ext/posix/tests/posix_geteuid_basic.phpt
new file mode 100644
index 0000000..76e9028
--- /dev/null
+++ b/ext/posix/tests/posix_geteuid_basic.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test function posix_geteuid() by calling it with its expected arguments
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+var_dump(posix_geteuid());
+?>
+--EXPECTF--
+int(%d)
diff --git a/ext/posix/tests/posix_geteuid_error1.phpt b/ext/posix/tests/posix_geteuid_error1.phpt
new file mode 100644
index 0000000..ac4e0d5
--- /dev/null
+++ b/ext/posix/tests/posix_geteuid_error1.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function posix_geteuid() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+$extra_args = array( 12312, 2 => '1234', 'string' => 'string' );
+
+var_dump( posix_geteuid( $extra_args ));
+foreach ( $extra_args as $arg )
+{
+ var_dump(posix_geteuid( $arg ));
+}
+
+?>
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: posix_geteuid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: posix_geteuid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: posix_geteuid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: posix_geteuid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
diff --git a/ext/posix/tests/posix_getgid_error.phpt b/ext/posix/tests/posix_getgid_error.phpt
new file mode 100644
index 0000000..bcd7a2f
--- /dev/null
+++ b/ext/posix/tests/posix_getgid_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getgid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getgid(void)
+ * Description: Get the current group id (POSIX.1, 4.2.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getgid() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getgid() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_getgid($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getgid() : error conditions ***
+
+-- Testing posix_getgid() function with one argument --
+
+Warning: posix_getgid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getgrgid.phpt b/ext/posix/tests/posix_getgrgid.phpt
new file mode 100644
index 0000000..0209d09
--- /dev/null
+++ b/ext/posix/tests/posix_getgrgid.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test posix_getgrgid().
+--CREDITS--
+Till Klampaeckel, till@php.net
+TestFest Berlin 2009
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+$grp = posix_getgrgid(0);
+if (!isset($grp['name'])) {
+ die('Array index "name" does not exist.');
+}
+if (!isset($grp['passwd'])) {
+ die('Array index "passwd" does not exist.');
+}
+if (!isset($grp['members'])) {
+ die('Array index "members" does not exist.');
+} elseif (!is_array($grp['members'])) {
+ die('Array index "members" must be an array.');
+} else {
+ if (count($grp['members']) > 0) {
+ foreach ($grp['members'] as $idx => $username) {
+ if (!is_int($idx)) {
+ die('Index in members Array is not an int.');
+ }
+ if (!is_string($username)) {
+ die('Username in members Array is not of type string.');
+ }
+ }
+ }
+}
+if (!isset($grp['gid'])) {
+ die('Array index "gid" does not exist.');
+}
+var_dump($grp['gid']);
+?>
+===DONE===
+--EXPECT--
+int(0)
+===DONE===
diff --git a/ext/posix/tests/posix_getgrgid_basic.phpt b/ext/posix/tests/posix_getgrgid_basic.phpt
new file mode 100644
index 0000000..fdcdf35
--- /dev/null
+++ b/ext/posix/tests/posix_getgrgid_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test posix_getgrgid() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX getgid and getgrid fucntions\n";
+
+ $gid = posix_getgid();
+ $groupinfo = posix_getgrgid($gid);
+
+ print_r($groupinfo);
+
+?>
+===DONE===
+--EXPECTF--
+Basic test of POSIX getgid and getgrid fucntions
+Array
+(
+ [name] => %s
+ [passwd] => %a
+ [members] => Array
+%a
+
+ [gid] => %d
+)
+===DONE===
+
diff --git a/ext/posix/tests/posix_getgrgid_error.phpt b/ext/posix/tests/posix_getgrgid_error.phpt
new file mode 100644
index 0000000..7fcc892
--- /dev/null
+++ b/ext/posix/tests/posix_getgrgid_error.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test posix_getgrgid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_getgrgid(long gid)
+ * Description: Group database access (POSIX.1, 9.2.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getgrgid() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing posix_getgrgid() function with Zero arguments --\n";
+var_dump( posix_getgrgid() );
+
+//Test posix_getgrgid with one more than the expected number of arguments
+echo "\n-- Testing posix_getgrgid() function with more than expected no. of arguments --\n";
+
+$extra_arg = 10;
+$gid = 0;
+var_dump( posix_getgrgid($gid, $extra_arg) );
+
+echo "\n-- Testing posix_getgrgid() function with a negative group id --\n";
+$gid = -999;
+var_dump( posix_getgrgid($gid));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getgrgid() : error conditions ***
+
+-- Testing posix_getgrgid() function with Zero arguments --
+
+Warning: posix_getgrgid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing posix_getgrgid() function with more than expected no. of arguments --
+
+Warning: posix_getgrgid() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing posix_getgrgid() function with a negative group id --
+bool(false)
+Done
diff --git a/ext/posix/tests/posix_getgrgid_macosx.phpt b/ext/posix/tests/posix_getgrgid_macosx.phpt
new file mode 100644
index 0000000..f9e6cc1
--- /dev/null
+++ b/ext/posix/tests/posix_getgrgid_macosx.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test return values of posix_getgrgid() on MacOSX.
+--CREDITS--
+Till Klampaeckel, till@php.net
+TestFest Berlin 2009
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+if (strtolower(PHP_OS) != 'darwin') {
+ die('SKIP This test requires MacOSX/Darwin.');
+}
+?>
+--FILE--
+<?php
+$grp = posix_getgrgid(-1);
+var_dump($grp['name']);
+?>
+===DONE===
+--EXPECT--
+string(7) "nogroup"
+===DONE===
diff --git a/ext/posix/tests/posix_getgrgid_variation.phpt b/ext/posix/tests/posix_getgrgid_variation.phpt
new file mode 100644
index 0000000..5cce391
--- /dev/null
+++ b/ext/posix/tests/posix_getgrgid_variation.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test posix_getgrgid() function : usage variations - parameter types
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_getgrgid(long gid)
+ * Description: Group database access (POSIX.1, 9.2.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getgrgid() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for gid
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ $result = posix_getgrgid($value);
+ if ((is_array($result) && (count($result) == 4))
+ ||
+ ($result === false)) {
+ echo "valid output\n";
+ } else {
+ var_dump($result);
+ }
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getgrgid() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+valid output
+
+Arg value -10.5
+valid output
+
+Arg value 101234567000
+valid output
+
+Arg value 1.07654321E-9
+valid output
+
+Arg value 0.5
+valid output
+
+Notice: Array to string conversion in %sposix_getgrgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getgrgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getgrgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getgrgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getgrgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value
+
+Warning: posix_getgrgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+
+Warning: posix_getgrgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getgrgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getgrgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_getgrgid_wrongparams.phpt b/ext/posix/tests/posix_getgrgid_wrongparams.phpt
new file mode 100644
index 0000000..d1ff77d
--- /dev/null
+++ b/ext/posix/tests/posix_getgrgid_wrongparams.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test parameters on posix_getgrgid().
+--CREDITS--
+Till Klampaeckel, till@php.net
+TestFest Berlin 2009
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+if (strtolower(PHP_OS) == 'darwin') {
+ die('SKIP This test doesn\'t run on MacOSX/Darwin.');
+}
+--FILE--
+<?php
+$gid = PHP_INT_MAX; // obscene high gid
+var_dump(posix_getgrgid($gid));
+var_dump(posix_getgrgid(-1));
+var_dump(posix_getgrgid());
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+
+Warning: posix_getgrgid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_getgrnam.phpt b/ext/posix/tests/posix_getgrnam.phpt
new file mode 100644
index 0000000..854db4a
--- /dev/null
+++ b/ext/posix/tests/posix_getgrnam.phpt
@@ -0,0 +1,19 @@
+--TEST--
+posix_getgrnam(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_getgrnam')) die('skip posix_getgrnam() not found');
+?>
+--FILE--
+<?php
+
+var_dump(posix_getgrnam(NULL));
+var_dump(posix_getgrnam(1));
+var_dump(posix_getgrnam(''));
+
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_getgrnam_basic.phpt b/ext/posix/tests/posix_getgrnam_basic.phpt
new file mode 100644
index 0000000..fd5bf23
--- /dev/null
+++ b/ext/posix/tests/posix_getgrnam_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+posix_getgrnam(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_getgrnam')) die('skip posix_getgrnam() not found');
+?>
+--FILE--
+<?php
+echo "Basic test of POSIX posix_getgrnam function\n";
+
+var_dump(posix_getgrnam(NULL));
+var_dump(posix_getgrnam(1));
+var_dump(posix_getgrnam(''));
+
+?>
+===DONE===
+--EXPECT--
+Basic test of POSIX posix_getgrnam function
+bool(false)
+bool(false)
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/posix/tests/posix_getgroups_basic.phpt b/ext/posix/tests/posix_getgroups_basic.phpt
new file mode 100644
index 0000000..f062468
--- /dev/null
+++ b/ext/posix/tests/posix_getgroups_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test posix_getgroups() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX getgroups\n";
+
+ $groups = posix_getgroups();
+
+ if (!is_array($groups)) {
+ echo "TEST FAILED - array result expected\n";
+ } else {
+ echo "TEST PASSED\n";
+ }
+
+?>
+===DONE===
+--EXPECT--
+Basic test of POSIX getgroups
+TEST PASSED
+===DONE=== \ No newline at end of file
diff --git a/ext/posix/tests/posix_getpgid_basic.phpt b/ext/posix/tests/posix_getpgid_basic.phpt
new file mode 100644
index 0000000..3195387
--- /dev/null
+++ b/ext/posix/tests/posix_getpgid_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test posix_getpgid() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of posix_getpgid function\n";
+
+ $pid = posix_getpid();
+ $pgid = posix_getpgid($pid);
+
+ var_dump($pgid);
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of posix_getpgid function
+int(%d)
+===DONE====
+
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_getpgid_error.phpt b/ext/posix/tests/posix_getpgid_error.phpt
new file mode 100644
index 0000000..b15a3c3
--- /dev/null
+++ b/ext/posix/tests/posix_getpgid_error.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test posix_getpgid() function : error conditions
+--SKIPIF--
+<?php
+if((!extension_loaded("posix")) || (!function_exists("posix_getpgid"))) {
+ print "skip - POSIX extension not loaded or posix_getpgid() does not exist";
+}
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getpgid(void)
+ * Description: Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpgid() : error conditions ***\n";
+
+echo "\n-- Testing posix_getpgid() function no arguments --\n";
+var_dump( posix_getpgid() );
+
+echo "\n-- Testing posix_getpgid() with one extra argument --\n";
+$pid = 10;
+$extra_arg = 20;
+var_dump( posix_getpgid($pid, $extra_arg) );
+
+echo "\n-- Testing posix_getpgid() with negative pid --\n";
+$pid = -99;
+var_dump( posix_getpgid($pid) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpgid() : error conditions ***
+
+-- Testing posix_getpgid() function no arguments --
+
+Warning: posix_getpgid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing posix_getpgid() with one extra argument --
+
+Warning: posix_getpgid() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing posix_getpgid() with negative pid --
+bool(false)
+Done
diff --git a/ext/posix/tests/posix_getpgid_variation.phpt b/ext/posix/tests/posix_getpgid_variation.phpt
new file mode 100644
index 0000000..b9c92b5
--- /dev/null
+++ b/ext/posix/tests/posix_getpgid_variation.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test posix_getpgid() function : variation
+--SKIPIF--
+<?php
+if((!extension_loaded("posix")) || (!function_exists("posix_getpgid"))) {
+ print "skip - POSIX extension not loaded or posix_getpgid() does not exist";
+}
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getpgid(void)
+ * Description: Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpgid() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for gid
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ $result = posix_getpgid($value);
+ if (is_int($result) || $result === false) {
+ echo "valid output\n";
+ } else {
+ var_dump($result);
+ }
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpgid() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+valid output
+
+Arg value -10.5
+valid output
+
+Arg value 101234567000
+valid output
+
+Arg value 1.07654321E-9
+valid output
+
+Arg value 0.5
+valid output
+
+Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getpgid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value
+
+Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+
+Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_getpgrp_basic.phpt b/ext/posix/tests/posix_getpgrp_basic.phpt
new file mode 100644
index 0000000..a737019
--- /dev/null
+++ b/ext/posix/tests/posix_getpgrp_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test posix_getpgrp() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX getpgrp function\n";
+
+ $pgrp = posix_getpgrp();
+
+ var_dump($pgrp);
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of POSIX getpgrp function
+int(%d)
+===DONE====
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_getpgrp_error.phpt b/ext/posix/tests/posix_getpgrp_error.phpt
new file mode 100644
index 0000000..97f47ce
--- /dev/null
+++ b/ext/posix/tests/posix_getpgrp_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getpgrp() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getpgrp(void)
+ * Description: Get current process group id (POSIX.1, 4.3.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpgrp() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getpgrp() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_getpgrp($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpgrp() : error conditions ***
+
+-- Testing posix_getpgrp() function with one argument --
+
+Warning: posix_getpgrp() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getpid_basic.phpt b/ext/posix/tests/posix_getpid_basic.phpt
new file mode 100644
index 0000000..a144441
--- /dev/null
+++ b/ext/posix/tests/posix_getpid_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test posix_getpid() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX getpid function\n";
+
+ $pid = posix_getpid();
+
+ var_dump($pid);
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of POSIX getpid function
+int(%d)
+===DONE====
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_getpid_error.phpt b/ext/posix/tests/posix_getpid_error.phpt
new file mode 100644
index 0000000..721bf66
--- /dev/null
+++ b/ext/posix/tests/posix_getpid_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getpid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getpid(void)
+ * Description: Get the current process id (POSIX.1, 4.1.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpid() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getpid() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_getpid($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpid() : error conditions ***
+
+-- Testing posix_getpid() function with one argument --
+
+Warning: posix_getpid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getppid_basic.phpt b/ext/posix/tests/posix_getppid_basic.phpt
new file mode 100644
index 0000000..2da591c
--- /dev/null
+++ b/ext/posix/tests/posix_getppid_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test posix_getppid() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX getppid function\n";
+
+ $ppid = posix_getppid();
+
+ var_dump($ppid);
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of POSIX getppid function
+int(%d)
+===DONE====
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_getppid_error.phpt b/ext/posix/tests/posix_getppid_error.phpt
new file mode 100644
index 0000000..366c1ed
--- /dev/null
+++ b/ext/posix/tests/posix_getppid_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getppid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getppid(void)
+ * Description: Get the parent process id (POSIX.1, 4.1.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getppid() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getppid() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_getppid($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getppid() : error conditions ***
+
+-- Testing posix_getppid() function with one argument --
+
+Warning: posix_getppid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getpwnam.phpt b/ext/posix/tests/posix_getpwnam.phpt
new file mode 100644
index 0000000..b5de1e4
--- /dev/null
+++ b/ext/posix/tests/posix_getpwnam.phpt
@@ -0,0 +1,19 @@
+--TEST--
+posix_getpwnam(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_getpwnam')) die('skip posix_getpwnam() not found');
+?>
+--FILE--
+<?php
+
+var_dump(posix_getpwnam(1));
+var_dump(posix_getpwnam(''));
+var_dump(posix_getpwnam(NULL));
+
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_getpwnam_basic.phpt b/ext/posix/tests/posix_getpwnam_basic.phpt
new file mode 100644
index 0000000..d675d6c
--- /dev/null
+++ b/ext/posix/tests/posix_getpwnam_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+posix_getpwnam(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_getpwnam')) die('skip posix_getpwnam() not found');
+?>
+--FILE--
+<?php
+echo "Basic test of POSIX posix_getpwnam function\n";
+
+var_dump(posix_getpwnam(1));
+var_dump(posix_getpwnam(''));
+var_dump(posix_getpwnam(NULL));
+
+?>
+===DONE====
+--EXPECT--
+Basic test of POSIX posix_getpwnam function
+bool(false)
+bool(false)
+bool(false)
+===DONE====
diff --git a/ext/posix/tests/posix_getpwuid_basic.phpt b/ext/posix/tests/posix_getpwuid_basic.phpt
new file mode 100644
index 0000000..1bcd59d
--- /dev/null
+++ b/ext/posix/tests/posix_getpwuid_basic.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test posix_getpwuid() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX getpwuid\n";
+
+
+ $pwuid = posix_getpwuid(posix_getuid());
+
+ print_r($pwuid);
+
+?>
+===DONE====
+--EXPECTREGEX--
+Basic test of POSIX getpwuid
+Array
+\(
+ \[name\] => [^\r\n]+
+ \[passwd\] => [^\r\n]+
+ \[uid\] => [0-9]+
+ \[gid\] => [0-9]+
+ \[gecos\] => [^\r\n]*
+ \[dir\] => [^\r\n]+
+ \[shell\] => [^\r\n]+
+\)
+===DONE==== \ No newline at end of file
diff --git a/ext/posix/tests/posix_getpwuid_error.phpt b/ext/posix/tests/posix_getpwuid_error.phpt
new file mode 100644
index 0000000..4920e4e
--- /dev/null
+++ b/ext/posix/tests/posix_getpwuid_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test posix_getpwuid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_getpwuid(long uid)
+ * Description: User database access (POSIX.1, 9.2.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpwuid() : error conditions ***\n";
+
+echo "\n-- Testing posix_getpwuid() function with Zero arguments --\n";
+var_dump( posix_getpwuid() );
+
+echo "\n-- Testing posix_getpwuid() function with more than expected no. of arguments --\n";
+$uid = posix_getuid();
+$extra_arg = 10;
+var_dump( posix_getpwuid($uid, $extra_arg) );
+
+echo "\n-- Testing posix_getpwuid() function negative uid --\n";
+$uid = -99;
+var_dump( posix_getpwuid($uid) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpwuid() : error conditions ***
+
+-- Testing posix_getpwuid() function with Zero arguments --
+
+Warning: posix_getpwuid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing posix_getpwuid() function with more than expected no. of arguments --
+
+Warning: posix_getpwuid() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing posix_getpwuid() function negative uid --
+bool(false)
+Done
diff --git a/ext/posix/tests/posix_getpwuid_variation.phpt b/ext/posix/tests/posix_getpwuid_variation.phpt
new file mode 100644
index 0000000..8b66f7f
--- /dev/null
+++ b/ext/posix/tests/posix_getpwuid_variation.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test posix_getpwuid() function : usage variations - parameter types
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_getpwuid(long uid)
+ * Description: User database access (POSIX.1, 9.2.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpwuid() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for uid
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ $result = posix_getpwuid($value);
+ if ((is_array($result) && (count($result) == 7))
+ ||
+ ($result === false)) {
+ echo "valid output\n";
+ } else {
+ var_dump($result);
+ }
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpwuid() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+valid output
+
+Arg value -10.5
+valid output
+
+Arg value 101234567000
+valid output
+
+Arg value 1.07654321E-9
+valid output
+
+Arg value 0.5
+valid output
+
+Notice: Array to string conversion in %sposix_getpwuid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getpwuid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getpwuid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getpwuid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Notice: Array to string conversion in %sposix_getpwuid_variation.php on line %d
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value
+
+Warning: posix_getpwuid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+
+Warning: posix_getpwuid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getpwuid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getpwuid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_getrlimit.phpt b/ext/posix/tests/posix_getrlimit.phpt
new file mode 100644
index 0000000..61da64a
--- /dev/null
+++ b/ext/posix/tests/posix_getrlimit.phpt
@@ -0,0 +1,17 @@
+--TEST--
+posix_getrlimit(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_getrlimit')) die('skip posix_getrlimit() not found');
+?>
+--FILE--
+<?php
+
+var_dump(posix_getrlimit());
+
+?>
+--EXPECTF--
+array(%d) {
+%a
+}
diff --git a/ext/posix/tests/posix_getrlimit_basic.phpt b/ext/posix/tests/posix_getrlimit_basic.phpt
new file mode 100644
index 0000000..7fdd0e7
--- /dev/null
+++ b/ext/posix/tests/posix_getrlimit_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+posix_getrlimit(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_getrlimit')) die('skip posix_getrlimit() not found');
+?>
+--FILE--
+<?php
+echo "Basic test of POSIX posix_getrlimit function\n";
+var_dump(posix_getrlimit());
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of POSIX posix_getrlimit function
+array(%d) {
+%a
+}
+===DONE==== \ No newline at end of file
diff --git a/ext/posix/tests/posix_getsid.phpt b/ext/posix/tests/posix_getsid.phpt
new file mode 100644
index 0000000..62ed3c9
--- /dev/null
+++ b/ext/posix/tests/posix_getsid.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test posix_getsid() function test
+--DESCRIPTION--
+Get the current session id of a process pid (POSIX.1, 4.2.1)
+Source code: ext/posix/posix.c
+--CREDITS--
+Moritz Neuhaeuser, info@xcompile.net
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "SKIP - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+echo "*** Testing posix_getsid() : function test ***\n";
+
+$pid = posix_getpid();
+echo "\n-- Testing posix_getsid() function with current process pid --\n";
+var_dump( is_long(posix_getsid($pid)) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing posix_getsid() : function test ***
+
+-- Testing posix_getsid() function with current process pid --
+bool(true)
+===DONE===
diff --git a/ext/posix/tests/posix_getsid_basic.phpt b/ext/posix/tests/posix_getsid_basic.phpt
new file mode 100644
index 0000000..a53e1df
--- /dev/null
+++ b/ext/posix/tests/posix_getsid_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test posix_getsid() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of posix_getsid function\n";
+
+ $pid = posix_getpid();
+ $sid = posix_getsid($pid);
+
+ var_dump($sid);
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of posix_getsid function
+int(%d)
+===DONE====
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_getsid_error.phpt b/ext/posix/tests/posix_getsid_error.phpt
new file mode 100644
index 0000000..445bc5a
--- /dev/null
+++ b/ext/posix/tests/posix_getsid_error.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test posix_getsid() function : error conditions
+--DESCRIPTION--
+cases: no params, wrong param, wrong param range
+--CREDITS--
+Moritz Neuhaeuser, info@xcompile.net
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) {
+ die("SKIP - POSIX extension not loaded");
+ }
+?>
+--FILE--
+<?php
+var_dump( posix_getsid() );
+var_dump( posix_getsid(array()) );
+var_dump( posix_getsid(-1) );
+?>
+===DONE===
+--EXPECTF--
+Warning: posix_getsid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: posix_getsid() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_getuid_error.phpt b/ext/posix/tests/posix_getuid_error.phpt
new file mode 100644
index 0000000..e759e68
--- /dev/null
+++ b/ext/posix/tests/posix_getuid_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getuid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getuid(void)
+ * Description: Get the current user id (POSIX.1, 4.2.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getuid() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getuid() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( posix_getuid($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getuid() : error conditions ***
+
+-- Testing posix_getuid() function with one argument --
+
+Warning: posix_getuid() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_initgroups.phpt b/ext/posix/tests/posix_initgroups.phpt
new file mode 100644
index 0000000..60121e8
--- /dev/null
+++ b/ext/posix/tests/posix_initgroups.phpt
@@ -0,0 +1,18 @@
+--TEST--
+posix_initgroups(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_initgroups')) die('skip posix_initgroups() not found');
+?>
+--FILE--
+<?php
+
+var_dump(posix_initgroups('foo', 'bar'));
+var_dump(posix_initgroups(NULL, NULL));
+
+?>
+--EXPECTF--
+Warning: posix_initgroups() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_initgroups_basic.phpt b/ext/posix/tests/posix_initgroups_basic.phpt
new file mode 100644
index 0000000..4a50059
--- /dev/null
+++ b/ext/posix/tests/posix_initgroups_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+posix_initgroups(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_initgroups')) die('skip posix_initgroups() not found');
+?>
+--FILE--
+<?php
+echo "Basic test of POSIX posix_initgroups function\n";
+var_dump(posix_initgroups('foo', 'bar'));
+var_dump(posix_initgroups(NULL, NULL));
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of POSIX posix_initgroups function
+
+Warning: posix_initgroups() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+bool(false)
+===DONE====
diff --git a/ext/posix/tests/posix_isatty.phpt b/ext/posix/tests/posix_isatty.phpt
new file mode 100644
index 0000000..0b40dd1
--- /dev/null
+++ b/ext/posix/tests/posix_isatty.phpt
@@ -0,0 +1,15 @@
+--TEST--
+posix_isatty(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_isatty')) die('skip posix_isatty() not found');
+?>
+--FILE--
+<?php
+
+var_dump(posix_isatty(0));
+
+?>
+--EXPECTF--
+bool(%s)
diff --git a/ext/posix/tests/posix_kill_basic.phpt b/ext/posix/tests/posix_kill_basic.phpt
new file mode 100644
index 0000000..c995031
--- /dev/null
+++ b/ext/posix/tests/posix_kill_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test posix_kill(), posix_get_last_error and posix_strerror() functions : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions\n";
+
+ // Don't rely on PCNTL extension being around
+ $SIGKILL = 9;
+
+ // TODO Once we have PS open working beef up this test to create a process and kill it
+ // for now start at a low pid and find first pid which does not exist.
+ $pid = 999;
+ do {
+ $pid += 1;
+ $result = shell_exec("ps -p " . $pid);
+ } while (stripos($result, (string)$pid) != FALSE);
+
+ echo "Kill pid=" . $pid . "\n";
+ var_dump(posix_kill($pid,$SIGKILL));
+
+ $errno = posix_get_last_error();
+
+ var_dump($errno);
+ var_dump(posix_strerror($errno));
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions
+Kill pid=%d
+bool(false)
+int(%d)
+string(%d) %sNo such process%s
+===DONE====
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_kill_error.phpt b/ext/posix/tests/posix_kill_error.phpt
new file mode 100644
index 0000000..082b21d
--- /dev/null
+++ b/ext/posix/tests/posix_kill_error.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test posix_kill() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto bool posix_kill(int pid, int sig)
+ * Description: Send a signal to a process (POSIX.1, 3.3.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing posix_kill() : error conditions ***\n";
+
+
+echo "\n-- Testing posix_kill() function with more than expected no. of arguments --\n";
+$pid = posix_getpid();
+$sig = 9;
+$extra_arg = 10;
+var_dump( posix_kill($pid, $sig, $extra_arg) );
+
+echo "\n-- Testing posix_kill() function with less than expected no. of arguments --\n";
+$pid = posix_getpid();
+var_dump( posix_kill($pid) );
+
+echo "\n-- Testing posix_kill() function with invalid signal --\n";
+$pid = posix_getpid();
+$sig = 999;
+var_dump( posix_kill($pid, 999) );
+
+echo "\n-- Testing posix_kill() function with negative pid --\n";
+$pid = -999;
+$sig = 9;
+var_dump( posix_kill($pid, 999) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_kill() : error conditions ***
+
+-- Testing posix_kill() function with more than expected no. of arguments --
+
+Warning: posix_kill() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+
+-- Testing posix_kill() function with less than expected no. of arguments --
+
+Warning: posix_kill() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing posix_kill() function with invalid signal --
+bool(false)
+
+-- Testing posix_kill() function with negative pid --
+bool(false)
+Done
diff --git a/ext/posix/tests/posix_kill_variation1.phpt b/ext/posix/tests/posix_kill_variation1.phpt
new file mode 100644
index 0000000..230977a
--- /dev/null
+++ b/ext/posix/tests/posix_kill_variation1.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test posix_kill() function : usage variations - first parameter type
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto bool posix_kill(int pid, int sig)
+ * Description: Send a signal to a process (POSIX.1, 3.3.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_kill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$sig = -999;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for pid
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( posix_kill($value, $sig) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_kill() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+
+Warning: posix_kill() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: posix_kill() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_kill() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_kill() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_kill_variation2.phpt b/ext/posix/tests/posix_kill_variation2.phpt
new file mode 100644
index 0000000..c03ead9
--- /dev/null
+++ b/ext/posix/tests/posix_kill_variation2.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test posix_kill() function : usage variations - second parameter type
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto bool posix_kill(int pid, int sig)
+ * Description: Send a signal to a process (POSIX.1, 3.3.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_kill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pid = -999;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for sig
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( posix_kill($pid, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_kill() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Notice: Array to string conversion in %sposix_kill_variation2.php on line %d
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+
+Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_mkfifo_safemode.phpt b/ext/posix/tests/posix_mkfifo_safemode.phpt
new file mode 100644
index 0000000..1126c00
--- /dev/null
+++ b/ext/posix/tests/posix_mkfifo_safemode.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test posix_mkfifo() with safe_mode.
+--DESCRIPTION--
+The test attempts to enable safe_mode, catches all the relevant E_WARNING's and tries to create a fifo in /tmp.
+
+The first attempt (writing to /tmp) should effectively fail because /tmp is owned by root.
+
+The second attempt (writing to a local created file) works.
+--CREDITS--
+Till Klampaeckel, till@php.net
+TestFest Berlin 2009
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+if (posix_geteuid() == 0) {
+ die('SKIP Cannot run test as root.');
+}
+if (PHP_VERSION_ID < 503099) {
+ die('SKIP Safe mode is no longer available.');
+}
+?>
+--FILE--
+<?php
+var_dump(posix_mkfifo('/tmp/foobar', 0644));
+
+$dir = dirname(__FILE__) . '/foo';
+mkdir ($dir);
+var_dump(posix_mkfifo($dir . '/bar', 0644));
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir = dirname(__FILE__) . '/foo';
+unlink($dir . '/bar');
+rmdir($dir);
+?>
+--EXPECTF--
+Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d
+
+Warning: posix_mkfifo(): SAFE MODE Restriction in effect. The script whose uid is %d is not allowed to access /tmp owned by uid %d in %s on line %d
+bool(false)
+bool(true)
+===DONE===
diff --git a/ext/posix/tests/posix_mkfifo_wrongparams.phpt b/ext/posix/tests/posix_mkfifo_wrongparams.phpt
new file mode 100644
index 0000000..0d4df7b
--- /dev/null
+++ b/ext/posix/tests/posix_mkfifo_wrongparams.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test parameter validation in posix_mkfifo().
+--CREDITS--
+Till Klampaeckel, till@php.net
+TestFest Berlin 2009
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+posix_mkfifo(null);
+var_dump(posix_mkfifo(null, 0644));
+?>
+===DONE===
+--EXPECTF--
+Warning: posix_mkfifo() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_mknod.phpt b/ext/posix/tests/posix_mknod.phpt
new file mode 100644
index 0000000..4044fb9
--- /dev/null
+++ b/ext/posix/tests/posix_mknod.phpt
@@ -0,0 +1,15 @@
+--TEST--
+posix_mknod(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_mknod')) die('skip posix_mknod() not found');
+?>
+--FILE--
+<?php
+
+var_dump(posix_mknod(NULL, NULL, NULL, NULL));
+
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/posix/tests/posix_mknod_basic.phpt b/ext/posix/tests/posix_mknod_basic.phpt
new file mode 100644
index 0000000..bc35156
--- /dev/null
+++ b/ext/posix/tests/posix_mknod_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+posix_mknod(): Basic tests
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+if (!function_exists('posix_mknod')) die('skip posix_mknod() not found');
+?>
+--FILE--
+<?php
+echo "Basic test of POSIX posix_mknod function\n";
+var_dump(posix_mknod(NULL, NULL, NULL, NULL));
+
+?>
+===DONE====
+--EXPECT--
+Basic test of POSIX posix_mknod function
+bool(false)
+===DONE==== \ No newline at end of file
diff --git a/ext/posix/tests/posix_seteuid_basic.phpt b/ext/posix/tests/posix_seteuid_basic.phpt
new file mode 100644
index 0000000..204ebe8
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test function posix_seteuid() by calling it with its expected arguments
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+
+$myuid = posix_geteuid();
+$uid = var_dump(posix_seteuid( $myuid ) );
+
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/posix/tests/posix_seteuid_error.phpt b/ext/posix/tests/posix_seteuid_error.phpt
new file mode 100644
index 0000000..b10e410
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test function posix_seteuid() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+$uid = '123';
+$extra_arg = '12312';
+
+var_dump(posix_seteuid( $uid, $extra_arg ) );
+var_dump(posix_seteuid( ) );
+
+
+?>
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: posix_seteuid() expects exactly 1 parameter, 2 given in %s on line 9
+bool(false)
+
+Warning: posix_seteuid() expects exactly 1 parameter, 0 given in %s on line 10
+bool(false)
diff --git a/ext/posix/tests/posix_seteuid_error2.phpt b/ext/posix/tests/posix_seteuid_error2.phpt
new file mode 100644
index 0000000..808f2d3
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_error2.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test function posix_seteuid() by substituting argument 1 with object values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_seteuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+Error: 2 - posix_seteuid() expects parameter 1 to be long, object given, %s
+bool(false)
+Error: 2 - posix_seteuid() expects parameter 1 to be long, object given, %s
+bool(false)
diff --git a/ext/posix/tests/posix_seteuid_variation1.phpt b/ext/posix/tests/posix_seteuid_variation1.phpt
new file mode 100644
index 0000000..841bfe0
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_variation1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test function posix_seteuid() by substituting argument 1 with array values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_seteuid( $var ) );
+}
+
+?>
+--EXPECTF--
+Warning: posix_seteuid() expects parameter 1 to be long, array given in %s on line 15
+bool(false)
+
+Warning: posix_seteuid() expects parameter 1 to be long, array given in %s on line 15
+bool(false)
+
+Warning: posix_seteuid() expects parameter 1 to be long, array given in %s on line 15
+bool(false)
+
+Warning: posix_seteuid() expects parameter 1 to be long, array given in %s on line 15
+bool(false)
diff --git a/ext/posix/tests/posix_seteuid_variation2.phpt b/ext/posix/tests/posix_seteuid_variation2.phpt
new file mode 100644
index 0000000..bcba394
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_variation2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function posix_seteuid() by substituting argument 1 with boolean values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_seteuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_seteuid_variation3.phpt b/ext/posix/tests/posix_seteuid_variation3.phpt
new file mode 100644
index 0000000..8b57864
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_variation3.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function posix_seteuid() by substituting argument 1 with emptyUnsetUndefNull values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_seteuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+
+Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 22
+bool(false)
+
+Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 22
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_seteuid_variation4.phpt b/ext/posix/tests/posix_seteuid_variation4.phpt
new file mode 100644
index 0000000..a647328
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_variation4.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test function posix_seteuid() by substituting argument 1 with float values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with float values ***\n";
+
+$myUid = posix_getuid();
+
+$myUid = $myUid - 1.1;
+
+$variation_array = array(
+ 'float '.$myUid => $myUid,
+ 'float -'.$myUid => -$myUid,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_seteuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_seteuid_variation5.phpt b/ext/posix/tests/posix_seteuid_variation5.phpt
new file mode 100644
index 0000000..8e43e1a
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_variation5.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function posix_seteuid() by substituting argument 1 with int values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int -12345' => -12345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_seteuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_seteuid_variation6.phpt b/ext/posix/tests/posix_seteuid_variation6.phpt
new file mode 100644
index 0000000..65ff56b
--- /dev/null
+++ b/ext/posix/tests/posix_seteuid_variation6.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function posix_seteuid() by substituting argument 1 with string values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with string values ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_seteuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with string values ***
+
+Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 21
+bool(false)
+
+Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 21
+bool(false)
+
+Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 21
+bool(false)
+
+Warning: posix_seteuid() expects parameter 1 to be long, string given in %s on line 21
+bool(false)
diff --git a/ext/posix/tests/posix_setgid_basic.phpt b/ext/posix/tests/posix_setgid_basic.phpt
new file mode 100644
index 0000000..da3751f
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function posix_setgid() by calling it with its expected arguments
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test by calling method or function with its expected arguments ***\n";
+
+$gid = posix_getgid();
+var_dump(posix_setgid( $gid ) );
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Test by calling method or function with its expected arguments ***
+bool(true)
+===DONE===
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_setgid_error.phpt b/ext/posix/tests/posix_setgid_error.phpt
new file mode 100644
index 0000000..83d727c
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test function posix_setgid() by calling it more than or less than its expected arguments.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+$gid = posix_getgid();
+$extra_arg = '123';
+
+var_dump(posix_setgid( $gid, $extra_arg ) );
+var_dump(posix_setgid( ) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: posix_setgid() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: posix_setgid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_setgid_variation1.phpt b/ext/posix/tests/posix_setgid_variation1.phpt
new file mode 100644
index 0000000..3690a77
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_variation1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test function posix_setgid() by substituting argument 1 with array values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setgid( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: posix_setgid() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: posix_setgid() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: posix_setgid() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: posix_setgid() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_setgid_variation2.phpt b/ext/posix/tests/posix_setgid_variation2.phpt
new file mode 100644
index 0000000..b8e50ba
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_variation2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function posix_setgid() by substituting argument 1 with boolean values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setgid( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
+
diff --git a/ext/posix/tests/posix_setgid_variation3.phpt b/ext/posix/tests/posix_setgid_variation3.phpt
new file mode 100644
index 0000000..cb9da62
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_variation3.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function posix_setgid() by substituting argument 1 with emptyUnsetUndefNull values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setgid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+
+Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_setgid_variation4.phpt b/ext/posix/tests/posix_setgid_variation4.phpt
new file mode 100644
index 0000000..faae4d4
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_variation4.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function posix_setgid() by substituting argument 1 with float values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with float values ***\n";
+
+
+
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setgid( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
+
diff --git a/ext/posix/tests/posix_setgid_variation5.phpt b/ext/posix/tests/posix_setgid_variation5.phpt
new file mode 100644
index 0000000..49e98ec
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_variation5.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test function posix_setgid() by substituting argument 1 with int values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+
+
+$variation_array = array (
+ 'long 0' => 0,
+ 'long 1' => 1,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setgid( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(false)
+bool(false)
+bool(false)
+===DONE===
+
diff --git a/ext/posix/tests/posix_setgid_variation6.phpt b/ext/posix/tests/posix_setgid_variation6.phpt
new file mode 100644
index 0000000..8557fd2
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_variation6.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test function posix_setgid() by substituting argument 1 with object values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setgid( $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+Error: 2 - posix_setgid() expects parameter 1 to be long, object given, %s
+bool(false)
+Error: 2 - posix_setgid() expects parameter 1 to be long, object given, %s
+bool(false)
+===DONE===
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_setgid_variation7.phpt b/ext/posix/tests/posix_setgid_variation7.phpt
new file mode 100644
index 0000000..f8083c3
--- /dev/null
+++ b/ext/posix/tests/posix_setgid_variation7.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function posix_setgid() by substituting argument 1 with string values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with string values ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setgid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with string values ***
+
+Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: posix_setgid() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
diff --git a/ext/posix/tests/posix_setuid_basic.phpt b/ext/posix/tests/posix_setuid_basic.phpt
new file mode 100644
index 0000000..986b0be
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test function posix_setuid() by calling it with its expected arguments
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+
+$myuid = posix_getuid();
+$uid = var_dump(posix_setuid( $myuid ) );
+
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/posix/tests/posix_setuid_error.phpt b/ext/posix/tests/posix_setuid_error.phpt
new file mode 100644
index 0000000..8aa5158
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function posix_setuid() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+$uid = '123';
+
+
+$extra_arg = '12312';
+
+var_dump(posix_setuid( $uid, $extra_arg ) );
+
+var_dump(posix_setuid( ) );
+
+
+?>
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: posix_setuid() expects exactly 1 parameter, 2 given in %s on line 11
+bool(false)
+
+Warning: posix_setuid() expects exactly 1 parameter, 0 given in %s on line 13
+bool(false)
diff --git a/ext/posix/tests/posix_setuid_error2.phpt b/ext/posix/tests/posix_setuid_error2.phpt
new file mode 100644
index 0000000..6ec0aa9
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_error2.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test function posix_setuid() by substituting argument 1 with object values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+Error: 2 - posix_setuid() expects parameter 1 to be long, object given, %s
+bool(false)
+Error: 2 - posix_setuid() expects parameter 1 to be long, object given, %s
+bool(false)
diff --git a/ext/posix/tests/posix_setuid_variation1.phpt b/ext/posix/tests/posix_setuid_variation1.phpt
new file mode 100644
index 0000000..bf6d437
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_variation1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test function posix_setuid() by substituting argument 1 with array values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setuid( $var ) );
+}
+
+?>
+--EXPECTF--
+Warning: posix_setuid() expects parameter 1 to be long, array given in %s on line 15
+bool(false)
+
+Warning: posix_setuid() expects parameter 1 to be long, array given in %s on line 15
+bool(false)
+
+Warning: posix_setuid() expects parameter 1 to be long, array given in %s on line 15
+bool(false)
+
+Warning: posix_setuid() expects parameter 1 to be long, array given in %s on line 15
+bool(false)
diff --git a/ext/posix/tests/posix_setuid_variation2.phpt b/ext/posix/tests/posix_setuid_variation2.phpt
new file mode 100644
index 0000000..77505a6
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_variation2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function posix_setuid() by substituting argument 1 with boolean values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_setuid_variation3.phpt b/ext/posix/tests/posix_setuid_variation3.phpt
new file mode 100644
index 0000000..4957229
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_variation3.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function posix_setuid() by substituting argument 1 with emptyUnsetUndefNull values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+
+Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 22
+bool(false)
+
+Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 22
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_setuid_variation4.phpt b/ext/posix/tests/posix_setuid_variation4.phpt
new file mode 100644
index 0000000..288ac0d
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_variation4.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test function posix_setuid() by substituting argument 1 with float values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with float values ***\n";
+
+$myUid = posix_getuid();
+
+$myUid = $myUid - 1.1;
+
+$variation_array = array(
+ 'float '.$myUid => $myUid,
+ 'float -'.$myUid => -$myUid,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_setuid_variation5.phpt b/ext/posix/tests/posix_setuid_variation5.phpt
new file mode 100644
index 0000000..a4ebe63
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_variation5.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function posix_setuid() by substituting argument 1 with int values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int -12345' => -12345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_setuid_variation6.phpt b/ext/posix/tests/posix_setuid_variation6.phpt
new file mode 100644
index 0000000..79e614f
--- /dev/null
+++ b/ext/posix/tests/posix_setuid_variation6.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function posix_setuid() by substituting argument 1 with string values.
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with string values ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_setuid( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with string values ***
+
+Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 21
+bool(false)
+
+Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 21
+bool(false)
+
+Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 21
+bool(false)
+
+Warning: posix_setuid() expects parameter 1 to be long, string given in %s on line 21
+bool(false)
diff --git a/ext/posix/tests/posix_strerror_error.phpt b/ext/posix/tests/posix_strerror_error.phpt
new file mode 100644
index 0000000..3803f46
--- /dev/null
+++ b/ext/posix/tests/posix_strerror_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test posix_strerror() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto string posix_strerror(int errno)
+ * Description: Retrieve the system error message associated with the given errno.
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_strerror() : error conditions ***\n";
+
+echo "\n-- Testing posix_strerror() function with Zero arguments --\n";
+var_dump( posix_strerror() );
+
+echo "\n-- Testing posix_strerror() function with more than expected no. of arguments --\n";
+$errno = posix_get_last_error();
+$extra_arg = 10;
+var_dump( posix_strerror($errno, $extra_arg) );
+
+echo "\n-- Testing posix_strerror() function with invalid error number --\n";
+$errno = -999;
+echo gettype( posix_strerror($errno) )."\n";
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_strerror() : error conditions ***
+
+-- Testing posix_strerror() function with Zero arguments --
+
+Warning: posix_strerror() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing posix_strerror() function with more than expected no. of arguments --
+
+Warning: posix_strerror() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing posix_strerror() function with invalid error number --
+string
+Done
diff --git a/ext/posix/tests/posix_strerror_variation1.phpt b/ext/posix/tests/posix_strerror_variation1.phpt
new file mode 100644
index 0000000..4d2b526
--- /dev/null
+++ b/ext/posix/tests/posix_strerror_variation1.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test posix_strerror() function : usage variations
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto string posix_strerror(int errno)
+ * Description: Retrieve the system error message associated with the given errno.
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_strerror() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for errno
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ echo gettype( posix_strerror($value) )."\n";
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_strerror() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+string
+
+Arg value -10.5
+string
+
+Arg value 101234567000
+string
+
+Arg value 1.07654321E-9
+string
+
+Arg value 0.5
+string
+
+Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+boolean
+
+Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+boolean
+
+Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+boolean
+
+Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+boolean
+
+Notice: Array to string conversion in %sposix_strerror_variation1.php on line %d
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+boolean
+
+Arg value
+string
+
+Arg value
+string
+
+Arg value 1
+string
+
+Arg value
+string
+
+Arg value 1
+string
+
+Arg value
+string
+
+Arg value
+
+Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
+boolean
+
+Arg value
+
+Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
+boolean
+
+Arg value string
+
+Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
+boolean
+
+Arg value string
+
+Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
+boolean
+
+Arg value
+string
+
+Arg value
+string
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_times.phpt b/ext/posix/tests/posix_times.phpt
new file mode 100644
index 0000000..6ad3407
--- /dev/null
+++ b/ext/posix/tests/posix_times.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test posix_times()
+--DESCRIPTION--
+Gets information about the current CPU usage.
+Source code: ext/posix/posix.c
+--CREDITS--
+Falko Menge, mail at falko-menge dot de
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) {
+ die('SKIP - POSIX extension not available');
+ }
+?>
+--FILE--
+<?php
+ var_dump(posix_times());
+?>
+===DONE===
+--EXPECTF--
+array(5) {
+ ["ticks"]=>
+ int(%i)
+ ["utime"]=>
+ int(%d)
+ ["stime"]=>
+ int(%d)
+ ["cutime"]=>
+ int(%d)
+ ["cstime"]=>
+ int(%d)
+}
+===DONE===
diff --git a/ext/posix/tests/posix_times_basic.phpt b/ext/posix/tests/posix_times_basic.phpt
new file mode 100644
index 0000000..5da6434
--- /dev/null
+++ b/ext/posix/tests/posix_times_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test posix_times() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX times function\n";
+
+ $times = posix_times();
+
+ var_dump($times);
+
+
+ if ($times == FALSE) {
+ $errno= posix_get_last_error();
+ var_dump(posix_strerror($errno));
+ }
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of POSIX times function
+array(5) {
+ ["ticks"]=>
+ int(%i)
+ ["utime"]=>
+ int(%i)
+ ["stime"]=>
+ int(%i)
+ ["cutime"]=>
+ int(%i)
+ ["cstime"]=>
+ int(%i)
+}
+===DONE====
diff --git a/ext/posix/tests/posix_times_error.phpt b/ext/posix/tests/posix_times_error.phpt
new file mode 100644
index 0000000..2766bc9
--- /dev/null
+++ b/ext/posix/tests/posix_times_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_times() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_times(void)
+ * Description: Get process times (POSIX.1, 4.5.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_times() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_times() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( posix_times($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_times() : error conditions ***
+
+-- Testing posix_times() function with one argument --
+
+Warning: posix_times() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_ttyname.phpt b/ext/posix/tests/posix_ttyname.phpt
new file mode 100644
index 0000000..76dff4e
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test posix_ttyname()
+--DESCRIPTION--
+Gets the absolute path to the current terminal device that is open on a given file descriptor.
+Source code: ext/posix/posix.c
+--CREDITS--
+Falko Menge, mail at falko-menge dot de
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) {
+ die('SKIP - POSIX extension not available');
+ }
+?>
+--FILE--
+<?php
+ var_dump(posix_ttyname(STDIN));
+ var_dump(posix_ttyname(STDERR));
+ var_dump(posix_ttyname(STDOUT));
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_ttyname_error.phpt b/ext/posix/tests/posix_ttyname_error.phpt
new file mode 100644
index 0000000..f7b011e
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function posix_ttyname() by calling it more than or less than its expected arguments
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+$fd = 'foo';
+$extra_arg = 'bar';
+
+var_dump(posix_ttyname( $fd, $extra_arg ) );
+
+var_dump(posix_ttyname( ) );
+
+
+?>
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: posix_ttyname() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: posix_ttyname() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
diff --git a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
new file mode 100644
index 0000000..daa487f
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test posix_ttyname() with wrong parameters
+--DESCRIPTION--
+Gets the absolute path to the current terminal device that is open on a given file descriptor.
+Source code: ext/posix/posix.c
+--CREDITS--
+Falko Menge, mail at falko-menge dot de
+PHP Testfest Berlin 2009-05-10
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) {
+ die('SKIP - POSIX extension not available');
+ }
+ if (!extension_loaded('gd')) {
+ die('SKIP - GD extension not available');
+ }
+ if (!function_exists('imagecreate')) {
+ die('SKIP - Function imagecreate() not available');
+ }
+?>
+--FILE--
+<?php
+ var_dump(posix_ttyname()); // param missing
+ var_dump(posix_ttyname(0)); // param not a ressource
+ var_dump(posix_ttyname(imagecreate(1, 1))); // wrong resource type
+?>
+===DONE===
+--EXPECTF--
+Warning: posix_ttyname() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+bool(false)
+
+Warning: posix_ttyname(): supplied resource is not a valid stream resource in %s on line %s
+
+Warning: posix_ttyname(): expects argument 1 to be a valid stream resource in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/posix/tests/posix_ttyname_variation1.phpt b/ext/posix/tests/posix_ttyname_variation1.phpt
new file mode 100644
index 0000000..efbf64a
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_variation1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test function posix_ttyname() by substituting argument 1 with array values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_ttyname( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_ttyname_variation2.phpt b/ext/posix/tests/posix_ttyname_variation2.phpt
new file mode 100644
index 0000000..3246142
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_variation2.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test function posix_ttyname() by substituting argument 1 with boolean values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_ttyname( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_ttyname_variation3.phpt b/ext/posix/tests/posix_ttyname_variation3.phpt
new file mode 100644
index 0000000..a3ebc8c
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_variation3.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test function posix_ttyname() by substituting argument 1 with emptyUnsetUndefNull values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_ttyname( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_ttyname_variation4.phpt b/ext/posix/tests/posix_ttyname_variation4.phpt
new file mode 100644
index 0000000..da99934
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_variation4.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function posix_ttyname() by substituting argument 1 with float values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with float values ***\n";
+
+
+
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_ttyname( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_ttyname_variation5.phpt b/ext/posix/tests/posix_ttyname_variation5.phpt
new file mode 100644
index 0000000..7290f07
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_variation5.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function posix_ttyname() by substituting argument 1 with int values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+
+
+$variation_array = array (
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_ttyname( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_ttyname_variation6.phpt b/ext/posix/tests/posix_ttyname_variation6.phpt
new file mode 100644
index 0000000..eecae67
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_variation6.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test function posix_ttyname() by substituting argument 1 with object values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_ttyname( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
+bool(false)
+Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d)
+bool(false)
diff --git a/ext/posix/tests/posix_ttyname_variation7.phpt b/ext/posix/tests/posix_ttyname_variation7.phpt
new file mode 100644
index 0000000..8a92ef6
--- /dev/null
+++ b/ext/posix/tests/posix_ttyname_variation7.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function posix_ttyname() by substituting argument 1 with string values.
+--CREDITS--
+Marco Fabbri mrfabbri@gmail.com
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--SKIPIF--
+<?php
+if (!extension_loaded('posix')) {
+ die('SKIP The posix extension is not loaded.');
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with string values ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(posix_ttyname( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with string values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/posix/tests/posix_uname_basic.phpt b/ext/posix/tests/posix_uname_basic.phpt
new file mode 100644
index 0000000..6bd5b10
--- /dev/null
+++ b/ext/posix/tests/posix_uname_basic.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test posix_uname() function : basic functionality
+--SKIPIF--
+<?php
+ if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
+?>
+--FILE--
+<?php
+ echo "Basic test of POSIX uname function\n";
+
+ $uname = posix_uname();
+ unset($uname['domainname']);
+ print_r($uname);
+
+?>
+===DONE====
+--EXPECTF--
+Basic test of POSIX uname function
+Array
+(
+ [sysname] => %s
+ [nodename] => %s
+ [release] => %s
+ [version] => %s
+ [machine] => %s
+)
+===DONE====
+ \ No newline at end of file
diff --git a/ext/posix/tests/posix_uname_error.phpt b/ext/posix/tests/posix_uname_error.phpt
new file mode 100644
index 0000000..4c753fe
--- /dev/null
+++ b/ext/posix/tests/posix_uname_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_uname() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_uname(void)
+ * Description: Get system name (POSIX.1, 4.4.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_uname() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_uname() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( posix_uname($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_uname() : error conditions ***
+
+-- Testing posix_uname() function with one argument --
+
+Warning: posix_uname() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done