mirror of
https://github.com/php/php-src.git
synced 2026-04-16 20:41:18 +02:00
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.
80 lines
1.7 KiB
PHP
80 lines
1.7 KiB
PHP
--TEST--
|
|
Test readdir() function : basic functionality
|
|
--SKIPIF--
|
|
<?php
|
|
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
|
die("skip Valid only on Windows");
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
/* Prototype : string readdir([resource $dir_handle])
|
|
* Description: Read directory entry from dir_handle
|
|
* Source code: ext/standard/dir.C
|
|
*/
|
|
|
|
/*
|
|
* Test basic functionality of readdir()
|
|
*/
|
|
|
|
echo "*** Testing readdir() : basic functionality ***\n";
|
|
|
|
// include the file.inc for Function: function create_files()
|
|
chdir(dirname(__FILE__));
|
|
include(dirname(__FILE__)."/../file/file.inc");
|
|
|
|
$path = dirname(__FILE__) . '/私はガラスを食べられますreaddir_basic';
|
|
mkdir($path);
|
|
create_files($path, 3);
|
|
|
|
echo "\n-- Call readdir() with \$path argument --\n";
|
|
var_dump($dh = opendir($path));
|
|
$a = array();
|
|
while( FALSE !== ($file = readdir($dh)) ) {
|
|
$a[] = $file;
|
|
}
|
|
sort($a);
|
|
foreach($a as $file) {
|
|
var_dump($file);
|
|
}
|
|
|
|
echo "\n-- Call readdir() without \$path argument --\n";
|
|
var_dump($dh = opendir($path));
|
|
$a = array();
|
|
while( FALSE !== ( $file = readdir() ) ) {
|
|
$a[] = $file;
|
|
}
|
|
sort($a);
|
|
foreach($a as $file) {
|
|
var_dump($file);
|
|
}
|
|
|
|
delete_files($path, 3);
|
|
closedir($dh);
|
|
?>
|
|
===DONE===
|
|
--CLEAN--
|
|
<?php
|
|
$path = dirname(__FILE__) . '/私はガラスを食べられますreaddir_basic';
|
|
rmdir($path);
|
|
?>
|
|
--EXPECTF--
|
|
*** Testing readdir() : basic functionality ***
|
|
|
|
-- Call readdir() with $path argument --
|
|
resource(%d) of type (stream)
|
|
string(1) "."
|
|
string(2) ".."
|
|
string(9) "file1.tmp"
|
|
string(9) "file2.tmp"
|
|
string(9) "file3.tmp"
|
|
|
|
-- Call readdir() without $path argument --
|
|
resource(%d) of type (stream)
|
|
string(1) "."
|
|
string(2) ".."
|
|
string(9) "file1.tmp"
|
|
string(9) "file2.tmp"
|
|
string(9) "file3.tmp"
|
|
===DONE===
|