1--TEST--
2Directory class behaviour.
3--FILE--
4<?php
5
6echo "\n--> Try all methods with bad handle:\n";
7$d = new Directory(getcwd());
8$d->handle = "Havoc!";
9try {
10    var_dump($d->read());
11} catch (TypeError $e) {
12    echo $e->getMessage(), "\n";
13}
14try {
15    var_dump($d->rewind());
16} catch (TypeError $e) {
17    echo $e->getMessage(), "\n";
18}
19try {
20    var_dump($d->close());
21} catch (TypeError $e) {
22    echo $e->getMessage(), "\n";
23}
24
25echo "\n--> Try all methods with no handle:\n";
26$d = new Directory(getcwd());
27unset($d->handle);
28
29try {
30    var_dump($d->read());
31} catch (\Error $e) {
32    echo $e->getMessage() . "\n";
33}
34try {
35    var_dump($d->rewind());
36} catch (\Error $e) {
37    echo $e->getMessage() . "\n";
38}
39try {
40    var_dump($d->close());
41} catch (\Error $e) {
42    echo $e->getMessage() . "\n";
43}
44
45?>
46--EXPECT--
47--> Try all methods with bad handle:
48Directory::read(): supplied argument is not a valid Directory resource
49Directory::rewind(): supplied argument is not a valid Directory resource
50Directory::close(): supplied argument is not a valid Directory resource
51
52--> Try all methods with no handle:
53Unable to find my handle property
54Unable to find my handle property
55Unable to find my handle property
56