From: Josie Messa Date: Mon, 10 Mar 2008 14:16:32 +0000 (+0000) Subject: - New tests for scandir() function X-Git-Tag: RELEASE_2_0_0a1~188 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fd345c31cf70640c8eab833932fdedecd32067e;p=php - New tests for scandir() function --- diff --git a/ext/standard/tests/dir/scandir_basic.phpt b/ext/standard/tests/dir/scandir_basic.phpt new file mode 100644 index 0000000000..e06f3b8375 --- /dev/null +++ b/ext/standard/tests/dir/scandir_basic.phpt @@ -0,0 +1,101 @@ +--TEST-- +Test scandir() function : basic functionality +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : basic functionality *** + +-- scandir() with mandatory arguments -- +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file1.tmp" + [3]=> + string(9) "file2.tmp" + [4]=> + string(9) "file3.tmp" +} + +-- scandir() with all arguments -- +array(5) { + [0]=> + string(9) "file3.tmp" + [1]=> + string(9) "file2.tmp" + [2]=> + string(9) "file1.tmp" + [3]=> + string(2) ".." + [4]=> + string(1) "." +} +===DONE=== +--UEXPECTF-- +*** Testing scandir() : basic functionality *** + +-- scandir() with mandatory arguments -- +array(5) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(9) "file1.tmp" + [3]=> + unicode(9) "file2.tmp" + [4]=> + unicode(9) "file3.tmp" +} + +-- scandir() with all arguments -- +array(5) { + [0]=> + unicode(9) "file3.tmp" + [1]=> + unicode(9) "file2.tmp" + [2]=> + unicode(9) "file1.tmp" + [3]=> + unicode(2) ".." + [4]=> + unicode(1) "." +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_error1.phpt b/ext/standard/tests/dir/scandir_error1.phpt new file mode 100644 index 0000000000..d1d3e0e3af --- /dev/null +++ b/ext/standard/tests/dir/scandir_error1.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test scandir() function : error conditions - Incorrect number of args +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : error conditions *** + +-- Testing scandir() function with Zero arguments -- + +Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing scandir() function with more than expected no. of arguments -- + +Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d +NULL +===DONE=== +--UEXPECTF-- +*** Testing scandir() : error conditions *** + +-- Testing scandir() function with Zero arguments -- + +Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing scandir() function with more than expected no. of arguments -- + +Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/scandir_error2.phpt b/ext/standard/tests/dir/scandir_error2.phpt new file mode 100644 index 0000000000..bf2432c66d --- /dev/null +++ b/ext/standard/tests/dir/scandir_error2.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test scandir() function : error conditions - Non-existent directory +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing scandir() : error conditions *** + +-- Pass scandir() an absolute path that does not exist -- + +Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Pass scandir() a relative path that does not exist -- + +Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== +--UEXPECTF-- +*** Testing scandir() : error conditions *** + +-- Pass scandir() an absolute path that does not exist -- + +Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Pass scandir() a relative path that does not exist -- + +Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation1.phpt b/ext/standard/tests/dir/scandir_variation1.phpt new file mode 100644 index 0000000000..010e4bfc3c --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation1.phpt @@ -0,0 +1,423 @@ +--TEST-- +Test scandir() function : usage variations - different data types as $dir arg +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- + +Warning: scandir(0): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: scandir(12345): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: scandir(-2345): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: scandir(10.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: scandir(-10.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: scandir(123456789000): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: scandir(1.23456789E-9): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: scandir(0.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 18 -- + +Notice: Array to string conversion in %s on line %d + +Warning: scandir(Array): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 19 -- + +Warning: scandir(string): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 20 -- + +Warning: scandir(string): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 21 -- + +Warning: scandir(hello world): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 22 -- + +Warning: scandir(Class A object): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 23 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: scandir(Resource id #%d): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- + +Warning: scandir(0): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: scandir(12345): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: scandir(-2345): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: scandir(10.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: scandir(-10.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 7 -- + +Warning: scandir(123456789000): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 8 -- + +Warning: scandir(1.23456789E-9): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 9 -- + +Warning: scandir(0.5): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 10 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: scandir(1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 18 -- + +Notice: Array to string conversion in %s on line %d + +Warning: scandir(Array): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 19 -- + +Warning: scandir(string): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 20 -- + +Warning: scandir(string): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 21 -- + +Warning: scandir(hello world): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 22 -- + +Warning: scandir(Class A object): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 23 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: scandir(Resource id #%d): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation2.phpt b/ext/standard/tests/dir/scandir_variation2.phpt new file mode 100644 index 0000000000..d32b4ec678 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation2.phpt @@ -0,0 +1,462 @@ +--TEST-- +Test scandir() function : usage variations - diff data types as $sorting_order arg +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 2 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 3 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 4 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 5 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 6 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 7 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 8 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 9 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 10 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 11 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 12 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 13 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 14 -- +array(2) { + [0]=> + string(2) ".." + [1]=> + string(1) "." +} + +-- Iteration 15 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 16 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: scandir() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: scandir() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: scandir() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 23 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 24 -- +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 25 -- + +Warning: scandir() expects parameter 2 to be long, resource given in %s on line %d +NULL +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 2 -- +array(2) { + [0]=> + unicode(2) ".." + [1]=> + unicode(1) "." +} + +-- Iteration 3 -- +array(2) { + [0]=> + unicode(2) ".." + [1]=> + unicode(1) "." +} + +-- Iteration 4 -- +array(2) { + [0]=> + unicode(2) ".." + [1]=> + unicode(1) "." +} + +-- Iteration 5 -- +array(2) { + [0]=> + unicode(2) ".." + [1]=> + unicode(1) "." +} + +-- Iteration 6 -- +array(2) { + [0]=> + unicode(2) ".." + [1]=> + unicode(1) "." +} + +-- Iteration 7 -- +array(2) { + [0]=> + unicode(2) ".." + [1]=> + unicode(1) "." +} + +-- Iteration 8 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 9 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 10 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 11 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 12 -- +array(2) { + [0]=> + unicode(2) ".." + [1]=> + unicode(1) "." +} + +-- Iteration 13 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 14 -- +array(2) { + [0]=> + unicode(2) ".." + [1]=> + unicode(1) "." +} + +-- Iteration 15 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 16 -- + +Warning: scandir() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: scandir() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: scandir() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: scandir() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: scandir() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: scandir() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 23 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 24 -- +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 25 -- + +Warning: scandir() expects parameter 2 to be long, resource given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation3.phpt b/ext/standard/tests/dir/scandir_variation3.phpt new file mode 100644 index 0000000000..0c266992e2 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation3.phpt @@ -0,0 +1,371 @@ +--TEST-- +Test scandir() function : usage variations - diff data types as $context arg +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 2 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 3 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 4 -- + +Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d +NULL + +-- Iteration 5 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 6 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: scandir() expects parameter 3 to be resource, Unicode string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: scandir() expects parameter 3 to be resource, Unicode string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: scandir() expects parameter 3 to be resource, Unicode string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: scandir() expects parameter 3 to be resource, Unicode string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: scandir() expects parameter 3 to be resource, Unicode string given in %s on line %d +NULL + +-- Iteration 22 -- + +Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d +NULL + +-- Iteration 23 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 24 -- + +Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d +NULL + +-- Iteration 25 -- + +Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation4.phpt b/ext/standard/tests/dir/scandir_variation4.phpt new file mode 100644 index 0000000000..eb1b8bf47c --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation4.phpt @@ -0,0 +1,271 @@ +--TEST-- +Test scandir() function : usage variations - different relative paths +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- $path = './level_one': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_one1.tmp" + [3]=> + string(14) "level_one2.tmp" + [4]=> + string(9) "level_two" +} + +-- $path = 'level_one/level_two': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_two1.tmp" + [3]=> + string(14) "level_two2.tmp" +} + +-- $path = '..': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_one1.tmp" + [3]=> + string(14) "level_one2.tmp" + [4]=> + string(9) "level_two" +} + +-- $path = 'level_two', '.': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_two1.tmp" + [3]=> + string(14) "level_two2.tmp" +} + +-- $path = '../': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_one1.tmp" + [3]=> + string(14) "level_one2.tmp" + [4]=> + string(9) "level_two" +} + +-- $path = './': -- +bool(true) +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_two1.tmp" + [3]=> + string(14) "level_two2.tmp" +} + +-- $path = '../../'level_one': -- +bool(true) +array(5) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(14) "level_one1.tmp" + [3]=> + string(14) "level_one2.tmp" + [4]=> + string(9) "level_two" +} +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** + +-- $path = './level_one': -- +bool(true) +array(5) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(14) "level_one1.tmp" + [3]=> + unicode(14) "level_one2.tmp" + [4]=> + unicode(9) "level_two" +} + +-- $path = 'level_one/level_two': -- +bool(true) +array(4) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(14) "level_two1.tmp" + [3]=> + unicode(14) "level_two2.tmp" +} + +-- $path = '..': -- +bool(true) +array(5) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(14) "level_one1.tmp" + [3]=> + unicode(14) "level_one2.tmp" + [4]=> + unicode(9) "level_two" +} + +-- $path = 'level_two', '.': -- +bool(true) +array(4) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(14) "level_two1.tmp" + [3]=> + unicode(14) "level_two2.tmp" +} + +-- $path = '../': -- +bool(true) +array(5) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(14) "level_one1.tmp" + [3]=> + unicode(14) "level_one2.tmp" + [4]=> + unicode(9) "level_two" +} + +-- $path = './': -- +bool(true) +array(4) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(14) "level_two1.tmp" + [3]=> + unicode(14) "level_two2.tmp" +} + +-- $path = '../../'level_one': -- +bool(true) +array(5) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(14) "level_one1.tmp" + [3]=> + unicode(14) "level_one2.tmp" + [4]=> + unicode(9) "level_two" +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation5.phpt b/ext/standard/tests/dir/scandir_variation5.phpt new file mode 100644 index 0000000000..9a41ef1840 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation5.phpt @@ -0,0 +1,115 @@ +--TEST-- +Test scandir() function : usage variations - different directory permissions +--SKIPIF-- + +--FILE-- + sub_dir ( sub parent ) + * |-> child_dir ( child dir) + */ + +$parent_dir_path = dirname(__FILE__) . "/scandir_variation5"; +mkdir($parent_dir_path); +chmod($parent_dir_path, 0777); + +// create sub_dir +$sub_dir_path = $parent_dir_path . "/sub_dir"; +mkdir($sub_dir_path); +chmod($sub_dir_path, 0777); + +//create sub_sub_dir +$child_dir_path = $sub_dir_path."/child_dir"; +mkdir($child_dir_path); + +// remove the write and execute permisson from sub parent +chmod($sub_dir_path, 0444); + +echo "\n-- After restricting 1st level parent directory --\n"; +var_dump(scandir($child_dir_path)); + +// remove the execute permisson from parent dir, allowing all permission for sub dir +chmod($sub_dir_path, 0777); // all permisson to sub dir +chmod($parent_dir_path, 0666); // restricting parent directory + +echo "\n-- After restricting parent directory --\n"; +var_dump(scandir($child_dir_path)); +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- After restricting 1st level parent directory -- + +Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- After restricting parent directory -- + +Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** + +-- After restricting 1st level parent directory -- + +Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- After restricting parent directory -- + +Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation6.phpt b/ext/standard/tests/dir/scandir_variation6.phpt new file mode 100644 index 0000000000..b963b79537 --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation6.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test scandir() function : usage variations - Wildcards in directory path +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Wildcard = '*' -- + +Warning: scandir(%s/scandir_var*): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +Warning: scandir(%s/*): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Wildcard = '?' -- + +Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** + +-- Wildcard = '*' -- + +Warning: scandir(%s/scandir_var*): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +Warning: scandir(%s/*): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +-- Wildcard = '?' -- + +Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) + +Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: %s in %s on line %d + +Warning: scandir(): (errno %d): %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation7.phpt b/ext/standard/tests/dir/scandir_variation7.phpt new file mode 100644 index 0000000000..ab220d6a4f --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation7.phpt @@ -0,0 +1,262 @@ +--TEST-- +Test scandir() function : usage variations - different directory permissions +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 2 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 3 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 4 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 5 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 6 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 7 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 8 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 9 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} + +-- Iteration 10 -- +bool(true) +array(2) { + [0]=> + string(1) "." + [1]=> + string(2) ".." +} +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 2 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 3 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 4 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 5 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 6 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 7 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 8 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 9 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} + +-- Iteration 10 -- +bool(true) +array(2) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation8.phpt b/ext/standard/tests/dir/scandir_variation8.phpt new file mode 100644 index 0000000000..d26441df1f --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation8.phpt @@ -0,0 +1,239 @@ +--TEST-- +Test scandir() function : usage variations - different file names +--FILE-- + $input) { + echo "\n-- Iteration $iterator --\n"; + $handle = "fp{$iterator}"; + var_dump( $$handle = fopen($dir_path . $input . '.tmp', 'w') ); + fclose($$handle); + $iterator++; +}; + +echo "\n-- Call to scandir() --\n"; +var_dump($content = scandir($dir_path)); + +// remove all files in directory so can remove directory in CLEAN section +foreach ($content as $file_name) { + // suppress errors as won't be able to remove "." and ".." entries + @unlink($dir_path . $file_name); +} +?> +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +resource(%d) of type (stream) + +-- Iteration 2 -- +resource(%d) of type (stream) + +-- Iteration 3 -- +resource(%d) of type (stream) + +-- Iteration 4 -- +resource(%d) of type (stream) + +-- Iteration 5 -- +resource(%d) of type (stream) + +-- Iteration 6 -- +resource(%d) of type (stream) + +-- Iteration 7 -- +resource(%d) of type (stream) + +-- Iteration 8 -- +resource(%d) of type (stream) + +-- Iteration 9 -- +resource(%d) of type (stream) + +-- Iteration 10 -- +resource(%d) of type (stream) + +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +resource(%d) of type (stream) + +-- Iteration 12 -- +resource(%d) of type (stream) + +-- Iteration 13 -- +resource(%d) of type (stream) + +-- Iteration 14 -- +resource(%d) of type (stream) + +-- Call to scandir() -- +array(16) { + [0]=> + string(9) "-10.5.tmp" + [1]=> + string(9) "-2345.tmp" + [2]=> + string(1) "." + [3]=> + string(2) ".." + [4]=> + string(4) ".tmp" + [5]=> + string(7) "0.5.tmp" + [6]=> + string(5) "0.tmp" + [7]=> + string(17) "1.23456789E-9.tmp" + [8]=> + string(5) "1.tmp" + [9]=> + string(8) "10.5.tmp" + [10]=> + string(9) "12345.tmp" + [11]=> + string(16) "123456789000.tmp" + [12]=> + string(9) "Array.tmp" + [13]=> + string(15) "double_file.tmp" + [14]=> + string(11) "hd_file.tmp" + [15]=> + string(15) "single_file.tmp" +} +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** + +-- Iteration 1 -- +resource(%d) of type (stream) + +-- Iteration 2 -- +resource(%d) of type (stream) + +-- Iteration 3 -- +resource(%d) of type (stream) + +-- Iteration 4 -- +resource(%d) of type (stream) + +-- Iteration 5 -- +resource(%d) of type (stream) + +-- Iteration 6 -- +resource(%d) of type (stream) + +-- Iteration 7 -- +resource(%d) of type (stream) + +-- Iteration 8 -- +resource(%d) of type (stream) + +-- Iteration 9 -- +resource(%d) of type (stream) + +-- Iteration 10 -- +resource(%d) of type (stream) + +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +resource(%d) of type (stream) + +-- Iteration 12 -- +resource(%d) of type (stream) + +-- Iteration 13 -- +resource(%d) of type (stream) + +-- Iteration 14 -- +resource(%d) of type (stream) + +-- Call to scandir() -- +array(16) { + [0]=> + unicode(9) "-10.5.tmp" + [1]=> + unicode(9) "-2345.tmp" + [2]=> + unicode(1) "." + [3]=> + unicode(2) ".." + [4]=> + unicode(4) ".tmp" + [5]=> + unicode(7) "0.5.tmp" + [6]=> + unicode(5) "0.tmp" + [7]=> + unicode(17) "1.23456789E-9.tmp" + [8]=> + unicode(5) "1.tmp" + [9]=> + unicode(8) "10.5.tmp" + [10]=> + unicode(9) "12345.tmp" + [11]=> + unicode(16) "123456789000.tmp" + [12]=> + unicode(9) "Array.tmp" + [13]=> + unicode(15) "double_file.tmp" + [14]=> + unicode(11) "hd_file.tmp" + [15]=> + unicode(15) "single_file.tmp" +} +===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation9.phpt b/ext/standard/tests/dir/scandir_variation9.phpt new file mode 100644 index 0000000000..8dca4782fa --- /dev/null +++ b/ext/standard/tests/dir/scandir_variation9.phpt @@ -0,0 +1,105 @@ +--TEST-- +Test scandir() function : usage variations - different ints as $sorting_order arg +--FILE-- + +===DONE=== +--CLEAN-- + +--EXPECTF-- +*** Testing scandir() : usage variations *** +array(4) { + [0]=> + string(9) "file2.tmp" + [1]=> + string(9) "file1.tmp" + [2]=> + string(2) ".." + [3]=> + string(1) "." +} +array(4) { + [0]=> + string(9) "file2.tmp" + [1]=> + string(9) "file1.tmp" + [2]=> + string(2) ".." + [3]=> + string(1) "." +} +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(9) "file1.tmp" + [3]=> + string(9) "file2.tmp" +} +===DONE=== +--UEXPECTF-- +*** Testing scandir() : usage variations *** +array(4) { + [0]=> + unicode(9) "file2.tmp" + [1]=> + unicode(9) "file1.tmp" + [2]=> + unicode(2) ".." + [3]=> + unicode(1) "." +} +array(4) { + [0]=> + unicode(9) "file2.tmp" + [1]=> + unicode(9) "file1.tmp" + [2]=> + unicode(2) ".." + [3]=> + unicode(1) "." +} +array(4) { + [0]=> + unicode(1) "." + [1]=> + unicode(2) ".." + [2]=> + unicode(9) "file1.tmp" + [3]=> + unicode(9) "file2.tmp" +} +===DONE===