summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/tempnam_variation6-win32.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/file/tempnam_variation6-win32.phpt')
-rw-r--r--ext/standard/tests/file/tempnam_variation6-win32.phpt62
1 files changed, 62 insertions, 0 deletions
diff --git a/ext/standard/tests/file/tempnam_variation6-win32.phpt b/ext/standard/tests/file/tempnam_variation6-win32.phpt
new file mode 100644
index 0000000000..efe7e86e85
--- /dev/null
+++ b/ext/standard/tests/file/tempnam_variation6-win32.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test tempnam() function: usage variations - Using previous unique filename
+--CREDITS--
+Dave Kelsey <d_kelsey@uk.ibm.com>
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Windows Only");
+?>
+--FILE--
+<?php
+/* Prototype: string tempnam ( string $dir, string $prefix );
+ Description: Create file with unique file name.
+*/
+
+/* Trying to create unique files by passing previously created unique file name as prefix */
+
+$file_path = dirname(__FILE__);
+
+echo "\n*** Test tempnam(): by passing previously created filenames ***\n";
+$file_name = "tempnam_variation6.tmp";
+for($i=1; $i<=3; $i++) {
+ echo "-- Iteration $i --\n";
+ $file_name = tempnam("$file_path", $file_name);
+
+ if( file_exists($file_name) ) {
+ echo "File name is => ";
+ print($file_name);
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+
+ if ($file_dir == sys_get_temp_dir()) {
+ echo "temp dir\n";
+ }
+ else if ($file_dir == $file_path) {
+ echo "directory specified\n";
+ }
+ else {
+ echo "unknown location\n";
+ }
+ }
+
+ unlink($file_name);
+}
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Test tempnam(): by passing previously created filenames ***
+-- Iteration 1 --
+File name is => %s%et%s
+File created in => directory specified
+-- Iteration 2 --
+File name is => %s%et%s
+File created in => directory specified
+-- Iteration 3 --
+File name is => %s%et%s
+File created in => directory specified
+
+*** Done ***