dir_variation8.phpt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --TEST--
  2. Test dir() function : usage variations - checking with wildcard characters
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) == 'WIN') {
  6. die('skip.. Not valid for Windows');
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /*
  12. * Create more than one temporary directory & subdirectory and check if dir() function can open
  13. * those directories when wildcard characters are used to refer to them.
  14. */
  15. echo "*** Testing dir() : checking with wildcard characters ***\n";
  16. // create the temporary directories
  17. $file_path = __DIR__;
  18. $dir_path = $file_path."/dir_variation81";
  19. $sub_dir_path = $dir_path."/sub_dir1";
  20. @mkdir($dir_path1);
  21. @mkdir($sub_dir_path);
  22. /* with different wildcard characters */
  23. echo "-- wildcard = '*' --\n";
  24. var_dump( dir($file_path."/dir_var*") );
  25. var_dump( dir($file_path."/*") );
  26. echo "-- wildcard = '?' --\n";
  27. var_dump( dir($dir_path."/sub_dir?") );
  28. var_dump( dir($dir_path."/sub?dir1") );
  29. echo "Done";
  30. ?>
  31. --EXPECTF--
  32. *** Testing dir() : checking with wildcard characters ***
  33. -- wildcard = '*' --
  34. Warning: dir(%s/dir_var*): Failed to open directory: %s in %s on line %d
  35. bool(false)
  36. Warning: dir(%s/*): Failed to open directory: %s in %s on line %d
  37. bool(false)
  38. -- wildcard = '?' --
  39. Warning: dir(%s/dir_variation81/sub_dir?): Failed to open directory: %s in %s on line %d
  40. bool(false)
  41. Warning: dir(%s/dir_variation81/sub?dir1): Failed to open directory: %s in %s on line %d
  42. bool(false)
  43. Done