xref: /PHP-7.0/ext/standard/tests/file/bug44805.phpt (revision 99ad08f9)
1--TEST--
2Bug#44806 (rename() function is not portable to Windows)
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') {
6    die('skip.. only for Windows');
7}
8?>
9--FILE--
10<?php
11$dirname = dirname(__FILE__);
12$file1 = $dirname . DIRECTORY_SEPARATOR . "file1.txt";
13$file2 = $dirname . DIRECTORY_SEPARATOR . "file2.txt";
14
15file_put_contents($file1, "this is file 1");
16file_put_contents($file2, "this is file 2");
17
18rename($file1, $file2);
19
20echo "reading file 2: ";
21readfile($file2);
22if (file_exists($file1)) {
23	unlink($file1);
24}
25if (file_exists($file2)) {
26	unlink($file2);
27}
28?>
29--EXPECT--
30reading file 2: this is file 1
31