jmessa Fri Mar 7 16:21:30 2008 UTC Modified files: /php-src/ext/standard/tests/dir rewinddir_variation3.phpt closedir_variation3.phpt readdir_variation7.phpt Log: - Tests awaiting fix of bug #44246 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/dir/rewinddir_variation3.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/dir/rewinddir_variation3.phpt diff -u /dev/null php-src/ext/standard/tests/dir/rewinddir_variation3.phpt:1.2 --- /dev/null Fri Mar 7 16:21:30 2008 +++ php-src/ext/standard/tests/dir/rewinddir_variation3.phpt Fri Mar 7 16:21:30 2008 @@ -0,0 +1,51 @@ +--TEST-- +Test rewinddir() function : usage variations - file pointers +--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 + */ + +/* + * Pass a file pointer to rewinddir() to test behaviour + */ + +echo "*** Testing rewinddir() : usage variations ***\n"; + +echo "\n-- Open a file using fopen --\n"; +var_dump($fp = fopen(__FILE__, 'r')); + +$result1 = fread($fp, 5); +var_dump(rewinddir($fp)); +$result2 = fread($fp, 5); + +echo "\n-- Check if rewinddir() has repositioned the file pointer --\n"; +if ($result1 === $result2) { + echo "rewinddir() works on file pointers\n"; +} else { + echo "rewinddir() does not work on file pointers\n"; +} +?> +===DONE=== +--EXPECTF-- +*** Testing rewinddir() : usage variations *** + +-- Open a file using fopen -- +resource(%d) of type (stream) +NULL + +-- Check if rewinddir() has repositioned the file pointer -- +rewinddir() does not work on file pointers +===DONE=== +--UEXPECTF-- +*** Testing rewinddir() : usage variations *** + +-- Open a file using fopen -- +resource(%d) of type (stream) +NULL + +-- Check if rewinddir() has repositioned the file pointer -- +rewinddir() does not work on file pointers +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/dir/closedir_variation3.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/dir/closedir_variation3.phpt diff -u /dev/null php-src/ext/standard/tests/dir/closedir_variation3.phpt:1.2 --- /dev/null Fri Mar 7 16:21:30 2008 +++ php-src/ext/standard/tests/dir/closedir_variation3.phpt Fri Mar 7 16:21:30 2008 @@ -0,0 +1,54 @@ +--TEST-- +Test closedir() function : usage variations - close a file pointer +--FILE-- +<?php +/* Prototype : void closedir([resource $dir_handle]) + * Description: Close directory connection identified by the dir_handle + * Source code: ext/standard/dir.c + * Alias to functions: close + */ + +/* + * Create a file pointer using fopen() then try to close it using closedir() + */ + +echo "*** Testing closedir() : usage variations ***\n"; + +echo "\n-- Open a file using fopen() --\n"; +var_dump($fp = fopen(__FILE__, 'r')); + +echo "\n-- Try to close the file pointer using closedir() --\n"; +var_dump(closedir($fp)); + +echo "\n-- Check file pointer: --\n"; +var_dump($fp); + +if(is_resource($fp)) { + fclose($fp); +} +?> +===DONE=== +--EXPECTF-- +*** Testing closedir() : usage variations *** + +-- Open a file using fopen() -- +resource(%d) of type (stream) + +-- Try to close the file pointer using closedir() -- +Warning: closedir(): %d is not a valid Directory resource in %s on line %d + +-- Check file pointer: -- +resource(%d) of type (stream) +===DONE=== +--UEXPECTF-- +*** Testing closedir() : usage variations *** + +-- Open a file using fopen() -- +resource(%d) of type (stream) + +-- Try to close the file pointer using closedir() -- +Warning: closedir(): %d is not a valid Directory resource in %s on line %d + +-- Check file pointer: -- +resource(%d) of type (stream) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/dir/readdir_variation7.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/dir/readdir_variation7.phpt diff -u /dev/null php-src/ext/standard/tests/dir/readdir_variation7.phpt:1.2 --- /dev/null Fri Mar 7 16:21:30 2008 +++ php-src/ext/standard/tests/dir/readdir_variation7.phpt Fri Mar 7 16:21:30 2008 @@ -0,0 +1,42 @@ +--TEST-- +Test readdir() function : usage variations - use file pointers +--FILE-- +<?php +/* Prototype : string readdir([resource $dir_handle]) + * Description: Read directory entry from dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Open a file pointer using fopen and pass to readdir() to test behaviour + */ + +echo "*** Testing readdir() : usage variations ***\n"; + +// get a resource variable +var_dump($fp = fopen(__FILE__, "r")); +var_dump( readdir($fp) ); + +// get file length over 256 characters +<<<EOT +123456789012345678901234567890 +123456789012345678901234567890 +123456789012345678901234567890 +123456789012345678901234567890 +123456789012345678901234567890 +EOT; +?> +===DONE=== +--EXPECTF-- +*** Testing readdir() : usage variations *** +resource(%d) of type (stream) + +Warning: readdir(): %d is not a valid Directory resource in %s on line %d +bool(false) +===DONE=== +--UEXPECTF-- +*** Testing readdir() : usage variations *** +resource(%d) of type (stream) + +Warning: readdir(): %d is not a valid Directory resource in %s on line %d +bool(false)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php