1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 08:28:26 +02:00
Files
archived-php-src/ext/standard/tests/dir/chdir_variation2-win32-mb.phpt
T
Anatol Belski 596f488e06 Add skipifs to some mb path tests
These were invented primarily to test the multibyte path handling
patch on Windows. How it turns out by PR #2105, some test issues
on some filesystems are possible. Particularly HFS is configurable
to use different ways to save filenames, see
https://developer.apple.com/library/mac/qa/qa1173/_index.html
This makes it impossible to test the filenames byte wise, while
the results are still correct. There are still several other tests
using UTF-8 file names spread over other extensions. So far no
false positives are to see, they don't need to be touched.
2016-09-02 19:46:32 +02:00

116 lines
3.5 KiB
PHP

--TEST--
Test chdir() function : usage variations - relative paths
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
die("skip Valid only on Windows");
}
?>
--FILE--
<?php
/* Prototype : bool chdir(string $directory)
* Description: Change the current directory
* Source code: ext/standard/dir.c
*/
/*
* Test chdir() with variations of relative paths
*/
echo "*** Testing chdir() : usage variations ***\n";
$base_dir_path = dirname(__FILE__);
$level_one_dir_name = "私はガラスを食べられますlevel_one";
$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
$level_two_dir_name = "私はガラスを食べられますlevel_two";
$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
// create directories
mkdir($level_one_dir_path);
mkdir($level_two_dir_path);
echo "\n-- \$directory = './私はガラスを食べられますlevel_one': --\n";
var_dump(chdir($base_dir_path));
var_dump(chdir("./$level_one_dir_name"));
var_dump(getcwd());
echo "\n-- \$directory = '私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two': --\n";
var_dump(chdir($base_dir_path));
var_dump(chdir("$level_one_dir_name/$level_two_dir_name"));
var_dump(getcwd());
echo "\n-- \$directory = '..': --\n";
var_dump(chdir('..'));
var_dump(getcwd());
echo "\n-- \$directory = '私はガラスを食べられますlevel_two', '.': --\n";
var_dump(chdir($level_two_dir_path));
var_dump(chdir('.'));
var_dump(getcwd());
echo "\n-- \$directory = '../': --\n";
var_dump(chdir('../'));
var_dump(getcwd());
echo "\n-- \$directory = './': --\n";
var_dump(chdir($level_two_dir_path));
var_dump(chdir('./'));
var_dump(getcwd());
echo "\n-- \$directory = '../../'私はガラスを食べられますlevel_one': --\n";
var_dump(chdir($level_two_dir_path));
var_dump(chdir("../../$level_one_dir_name"));
var_dump(getcwd());
$file_path = dirname(__FILE__);
chdir($file_path);/* not that PWD is accidentialy one of the dirs to be deleted. */
rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two");
rmdir("$file_path/私はガラスを食べられますlevel_one");
?>
===DONE===
--CLEAN--
<?php
$file_path = dirname(__FILE__);
chdir($file_path);/* not that PWD is accidentialy one of the dirs to be deleted. */
rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two");
rmdir("$file_path/私はガラスを食べられますlevel_one");
?>
--EXPECTF--
*** Testing chdir() : usage variations ***
-- $directory = './私はガラスを食べられますlevel_one': --
bool(true)
bool(true)
string(%d) "%slevel_one"
-- $directory = '私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two': --
bool(true)
bool(true)
string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two"
-- $directory = '..': --
bool(true)
string(%d) "%s私はガラスを食べられますlevel_one"
-- $directory = '私はガラスを食べられますlevel_two', '.': --
bool(true)
bool(true)
string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two"
-- $directory = '../': --
bool(true)
string(%d) "%slevel_one"
-- $directory = './': --
bool(true)
bool(true)
string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two"
-- $directory = '../../'私はガラスを食べられますlevel_one': --
bool(true)
bool(true)
string(%d) "%s私はガラスを食べられますlevel_one"
===DONE===