summaryrefslogtreecommitdiff
path: root/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
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/posix_ttyname_error_wrongparams.phpt
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/posix_ttyname_error_wrongparams.phpt')
-rw-r--r--ext/posix/tests/posix_ttyname_error_wrongparams.phpt37
1 files changed, 37 insertions, 0 deletions
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===