summaryrefslogtreecommitdiff
path: root/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt
blob: d38571c88a4ad42363530311b3b357a0a3d16691 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--TEST--
Test rewinddir() function : usage variations - operate on a closed directory
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
  die("skip Valid only on Windows");
}
?>
--FILE--
<?php
/* Prototype  : void rewinddir([resource $dir_handle])
 * Description: Rewind dir_handle back to the start
 * Source code: ext/standard/dir.c
 * Alias to functions: rewind
 */

/*
 * Open and close a directory handle then call rewinddir() to test behaviour
 */

echo "*** Testing rewinddir() : usage variations ***\n";

$dir_path = __DIR__ . '/私はガラスを食べられますrewinddir_variation2';
mkdir($dir_path);

echo "\n-- Create the directory handle, read and close the directory --\n";
var_dump($dir_handle = opendir($dir_path));
var_dump(readdir($dir_handle));
closedir($dir_handle);

echo "\n-- Call to rewinddir() --\n";
try {
    var_dump(rewinddir($dir_handle));
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}
?>
===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . '/私はガラスを食べられますrewinddir_variation2';
rmdir($dir_path);
?>
--EXPECTF--
*** Testing rewinddir() : usage variations ***

-- Create the directory handle, read and close the directory --
resource(%d) of type (stream)
string(%d) "%s"

-- Call to rewinddir() --
rewinddir(): %s is not a valid Directory resource
===DONE===