--- /dev/null
+--TEST--
+Directory class behaviour.
+--FILE--
+<?php
+/*
+ * Prototype: object dir(string directory[, resource context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Class is defined in ext/standard/dir.c
+ */
+
+echo "Structure of Directory class:\n";
+$rc = new ReflectionClass("Directory");
+echo $rc;
+
+echo "Cannot instantiate a valid Directory directly:\n";
+$d = new Directory(getcwd());
+var_dump($d);
+var_dump($d->read());
+
+?>
+--EXPECTF--
+Structure of Directory class:
+Class [ <internal%s> class Directory ] {
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [0] {
+ }
+
+ - Methods [3] {
+ Method [ <internal%s> public method close ] {
+ }
+
+ Method [ <internal%s> public method rewind ] {
+ }
+
+ Method [ <internal%s> public method read ] {
+ }
+ }
+}
+Cannot instantiate a valid Directory directly:
+object(Directory)#%d (0) {
+}
+
+Warning: Directory::read(): Unable to find my handle property in %s on line 15
+bool(false)
\ No newline at end of file
--- /dev/null
+--TEST--
+Directory class behaviour.
+--FILE--
+<?php
+
+echo "\n--> Try all methods with bad handle:\n";
+$d = new Directory(getcwd());
+$d->handle = "Havoc!";
+var_dump($d->read());
+var_dump($d->rewind());
+var_dump($d->close());
+
+echo "\n--> Try all methods with no handle:\n";
+$d = new Directory(getcwd());
+unset($d->handle);
+var_dump($d->read());
+var_dump($d->rewind());
+var_dump($d->close());
+
+echo "\n--> Try all methods with wrong number of args:\n";
+$d = new Directory(getcwd());
+var_dump($d->read(1,2));
+var_dump($d->rewind(1,2));
+var_dump($d->close(1,2));
+
+?>
+--EXPECTF--
+--> Try all methods with bad handle:
+
+Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+--> Try all methods with no handle:
+
+Warning: Directory::read(): Unable to find my handle property in %s on line %d
+bool(false)
+
+Warning: Directory::rewind(): Unable to find my handle property in %s on line %d
+bool(false)
+
+Warning: Directory::close(): Unable to find my handle property in %s on line %d
+bool(false)
+
+--> Try all methods with wrong number of args:
+
+Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d
+NULL
--- /dev/null
+--TEST--
+Test that the Directory extension constants are correctly defined.
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+echo DIRECTORY_SEPARATOR;
+
+echo "\n";
+
+echo PATH_SEPARATOR;
+
+echo "\n";
+
+echo "done";
+
+?>
+--EXPECT--
+\
+;
+done
--- /dev/null
+--TEST--
+Test that the Directory extension constants are correctly defined.
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip.. Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+
+echo DIRECTORY_SEPARATOR;
+
+echo "\n";
+
+echo PATH_SEPARATOR;
+
+echo "\n";
+
+echo "done";
+
+?>
+--EXPECT--
+/
+:
+done