summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/glob_basic.phpt
diff options
context:
space:
mode:
authorRaghubansh Kumar <kraghuba@php.net>2007-07-23 05:22:59 +0000
committerRaghubansh Kumar <kraghuba@php.net>2007-07-23 05:22:59 +0000
commit6e8d7aa85d0c8a94b4409ae3b1884afd8b391dd0 (patch)
treebe1ffee9cab8a8d7802fe169b7d964f4c555611b /ext/standard/tests/file/glob_basic.phpt
parente6e823c8449403d37a82beec729d9aa888096c15 (diff)
downloadphp-git-6e8d7aa85d0c8a94b4409ae3b1884afd8b391dd0.tar.gz
New testcases for glob() function
Diffstat (limited to 'ext/standard/tests/file/glob_basic.phpt')
-rwxr-xr-xext/standard/tests/file/glob_basic.phpt77
1 files changed, 77 insertions, 0 deletions
diff --git a/ext/standard/tests/file/glob_basic.phpt b/ext/standard/tests/file/glob_basic.phpt
new file mode 100755
index 0000000000..68e1bc74b1
--- /dev/null
+++ b/ext/standard/tests/file/glob_basic.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test glob() function: basic functions
+--FILE--
+<?php
+/* Prototype: array glob ( string $pattern [, int $flags] );
+ Description: Find pathnames matching a pattern
+*/
+
+echo "*** Testing glob() : basic functions ***\n";
+
+$file_path = dirname(__FILE__);
+
+// temp dirname used here
+$dirname = "$file_path/glob_basic";
+
+// temp dir created
+mkdir($dirname);
+
+// temp files created
+$fp = fopen("$dirname/wonder12345", "w");
+fclose($fp);
+$fp = fopen("$dirname/wonder.txt", "w");
+fclose($fp);
+$fp = fopen("$dirname/file.text", "w");
+fclose($fp);
+
+// glob() with default arguments
+var_dump( glob($dirname."/*") );
+var_dump( glob($dirname."/*.txt") );
+var_dump( glob($dirname."/*.t?t") );
+var_dump( glob($dirname."/*.t*t") );
+var_dump( glob($dirname."/*.?") );
+var_dump( glob($dirname."/*.*") );
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/glob_basic/wonder12345");
+unlink("$file_path/glob_basic/wonder.txt");
+unlink("$file_path/glob_basic/file.text");
+rmdir("$file_path/glob_basic/");
+?>
+--EXPECTF--
+*** Testing glob() : basic functions ***
+array(3) {
+ [0]=>
+ string(%d) "%s/glob_basic/file.text"
+ [1]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+ [2]=>
+ string(%d) "%s/glob_basic/wonder12345"
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_basic/file.text"
+ [1]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+}
+array(0) {
+}
+array(2) {
+ [0]=>
+ string(%d) "%s/glob_basic/file.text"
+ [1]=>
+ string(%d) "%s/glob_basic/wonder.txt"
+}
+Done