1--TEST-- 2Test readdir() function : usage variations - sub-directories 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != 'WIN') { 6 die("skip Valid only on Windows"); 7} 8?> 9--FILE-- 10<?php 11/* 12 * Pass a directory handle pointing to a directory that has a sub-directory 13 * to test behaviour of readdir() 14 */ 15 16echo "*** Testing readdir() : usage variations ***\n"; 17 18// include the file.inc for Function: function create_files() 19chdir(__DIR__); 20include(__DIR__."/../file/file.inc"); 21 22$path_top = __DIR__ . '/readdir_variation3-win32-mb'; 23$path_sub = $path_top . '/私はガラスを食べられますsub_folder'; 24mkdir($path_top); 25mkdir($path_sub); 26 27create_files($path_top, 2); 28create_files($path_sub, 2); 29 30$dir_handle = opendir($path_top); 31while(FALSE !== ($file = readdir($dir_handle))) { 32 33 // different OS order files differently so will 34 // store file names into an array so can use sorted in expected output 35 $contents[] = $file; 36} 37 38// more important to check that all contents are present than order they are returned in 39sort($contents); 40var_dump($contents); 41 42delete_files($path_top, 2); 43delete_files($path_sub, 2); 44 45closedir($dir_handle); 46?> 47--CLEAN-- 48<?php 49$path_top = __DIR__ . '/readdir_variation3-win32-mb'; 50$path_sub = $path_top . '/私はガラスを食べられますsub_folder'; 51rmdir($path_sub); 52rmdir($path_top); 53?> 54--EXPECT-- 55*** Testing readdir() : usage variations *** 56array(5) { 57 [0]=> 58 string(1) "." 59 [1]=> 60 string(2) ".." 61 [2]=> 62 string(9) "file1.tmp" 63 [3]=> 64 string(9) "file2.tmp" 65 [4]=> 66 string(46) "私はガラスを食べられますsub_folder" 67} 68