summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/readlink_realpath_variation3.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/standard/tests/file/readlink_realpath_variation3.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/standard/tests/file/readlink_realpath_variation3.phpt')
-rw-r--r--ext/standard/tests/file/readlink_realpath_variation3.phpt77
1 files changed, 77 insertions, 0 deletions
diff --git a/ext/standard/tests/file/readlink_realpath_variation3.phpt b/ext/standard/tests/file/readlink_realpath_variation3.phpt
new file mode 100644
index 0000000..3766a5b
--- /dev/null
+++ b/ext/standard/tests/file/readlink_realpath_variation3.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test readlink() and realpath() functions: usage variation - invalid args
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: string readlink ( string $path );
+ Description: Returns the target of a symbolic link
+
+ Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "*** Testing readlink() and realpath() : usage variations ***\n";
+
+echo "\n*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***\n";
+$link_string = array (
+ /* linkname as spaces */
+ " ",
+ ' ',
+
+ /* empty linkname */
+ "",
+ '',
+ NULL,
+ null
+ );
+for($loop_counter = 0; $loop_counter < count($link_string); $loop_counter++) {
+ echo "-- Iteration";
+ echo $loop_counter + 1;
+ echo " --\n";
+
+ var_dump( readlink($link_string[$loop_counter]) );
+ var_dump( realpath($link_string[$loop_counter]) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing readlink() and realpath() : usage variations ***
+
+*** Testing readlink() and realpath() with linkname as empty string, NULL and single space ***
+-- Iteration1 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+%s
+-- Iteration2 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+%s
+-- Iteration3 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%s"
+-- Iteration4 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%s"
+-- Iteration5 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%s"
+-- Iteration6 --
+
+Warning: readlink(): %s in %s on line %d
+bool(false)
+string(%d) "%s"
+Done