From: Ant Phillips Date: Thu, 27 Nov 2008 14:49:14 +0000 (+0000) Subject: Directory tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit). X-Git-Tag: BEFORE_HEAD_NS_CHANGES_MERGE~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0920ed8861a109804b4575075bb2d729b41aec04;p=php Directory tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit). --- diff --git a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt new file mode 100644 index 0000000000..e8ffd5752a --- /dev/null +++ b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt @@ -0,0 +1,53 @@ +--TEST-- +Directory class behaviour. +--FILE-- +read()); + +?> +--EXPECTF-- +Structure of Directory class: +Class [ class Directory ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [3] { + Method [ public method close ] { + } + + Method [ public method rewind ] { + } + + Method [ 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 diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt new file mode 100644 index 0000000000..5b2771eef6 --- /dev/null +++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt @@ -0,0 +1,59 @@ +--TEST-- +Directory class behaviour. +--FILE-- + 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 diff --git a/ext/standard/tests/directory/directory_constants-win32.phpt b/ext/standard/tests/directory/directory_constants-win32.phpt new file mode 100644 index 0000000000..6a9a066d64 --- /dev/null +++ b/ext/standard/tests/directory/directory_constants-win32.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test that the Directory extension constants are correctly defined. +--SKIPIF-- + +--FILE-- + +--EXPECT-- +\ +; +done diff --git a/ext/standard/tests/directory/directory_constants.phpt b/ext/standard/tests/directory/directory_constants.phpt new file mode 100644 index 0000000000..f8e143bc13 --- /dev/null +++ b/ext/standard/tests/directory/directory_constants.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test that the Directory extension constants are correctly defined. +--SKIPIF-- + +--FILE-- + +--EXPECT-- +/ +: +done