summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorLars Strojny <lstrojny@php.net>2012-09-18 23:17:31 +0200
committerLars Strojny <lstrojny@php.net>2012-09-18 23:17:31 +0200
commit6793e09a4ef164fac343e50c39d284fbbe3e6050 (patch)
treec4a5f967a093ceaee93b8e4c012cb676dd789689 /ext
parentd0e96a5575ba3322565f12da97d0bd05e3242408 (diff)
parentee172ce3cc65b5cb8ec49020c9579d108aca9ea1 (diff)
downloadphp-git-6793e09a4ef164fac343e50c39d284fbbe3e6050.tar.gz
Merge branch 'PHP-5.4'
Diffstat (limited to 'ext')
-rw-r--r--ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt52
-rw-r--r--ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt58
-rw-r--r--ext/standard/tests/strings/http_build_query_error.phpt13
3 files changed, 123 insertions, 0 deletions
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
new file mode 100644
index 0000000000..5107cd32b6
--- /dev/null
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
@@ -0,0 +1,52 @@
+--TEST--
+RecursiveDirectoryIterator::getBasePath() - basic test
+--CREDITS--
+Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+<?php
+$depth0 = md5('recursiveDirectoryIterator::getSubPath');
+$depth1 = md5('depth1');
+$depth2 = md5('depth2');
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
+mkdir($targetDir, 0777, true);
+touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPath_test.tmp');
+$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
+$it = new RecursiveIteratorIterator($iterator);
+
+$list = [];
+while($it->valid()) {
+ $list[] = $it->getSubPath();
+ $it->next();
+}
+asort($list);
+foreach ($list as $item) {
+ echo $item . "\n";
+}
+?>
+==DONE==
+--CLEAN--
+<?php
+function rrmdir($dir) {
+ foreach(glob($dir . '/*') as $file) {
+ if(is_dir($file)) {
+ rrmdir($file);
+ } else {
+ unlink($file);
+ }
+ }
+
+ rmdir($dir);
+ }
+
+ $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('recursiveDirectoryIterator::getSubPath');
+ rrmdir($targetDir);
+?>
+
+--EXPECT--
+a0c967a6c2c34786e4802f59af9356f5
+a0c967a6c2c34786e4802f59af9356f5
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+==DONE==
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
new file mode 100644
index 0000000000..4e17ea9d42
--- /dev/null
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+RecursiveDirectoryIterator::getBasePathname() - basic test
+--CREDITS--
+Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+<?php
+$depth0 = md5('recursiveDirectoryIterator::getSubPathname');
+$depth1 = md5('depth1');
+$depth2 = md5('depth2');
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
+mkdir($targetDir, 0777, true);
+touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPathname_test_2.tmp');
+touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . 'getSubPathname_test_3.tmp');
+touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 'getSubPathname_test_1.tmp');
+$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
+$it = new RecursiveIteratorIterator($iterator);
+
+$list = [];
+while($it->valid()) {
+ $list[] = $it->getSubPathname();
+ $it->next();
+}
+asort($list);
+foreach ($list as $item) {
+ echo $item . "\n";
+}
+?>
+==DONE==
+--CLEAN--
+<?php
+function rrmdir($dir) {
+ foreach(glob($dir . '/*') as $file) {
+ if(is_dir($file)) {
+ rrmdir($file);
+ } else {
+ unlink($file);
+ }
+ }
+
+ rmdir($dir);
+}
+
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . md5('recursiveDirectoryIterator::getSubPathname');
+rrmdir($targetDir);
+?>
+--EXPECT--
+.
+.
+..
+a0c967a6c2c34786e4802f59af9356f5/.
+a0c967a6c2c34786e4802f59af9356f5/..
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/.
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/..
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/getSubPathname_test_2.tmp
+a0c967a6c2c34786e4802f59af9356f5/getSubPathname_test_3.tmp
+getSubPathname_test_1.tmp
+==DONE==
diff --git a/ext/standard/tests/strings/http_build_query_error.phpt b/ext/standard/tests/strings/http_build_query_error.phpt
new file mode 100644
index 0000000000..30155e62a3
--- /dev/null
+++ b/ext/standard/tests/strings/http_build_query_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Testing error on null parameter 1 of http_build_query()
+--CREDITS--
+Pawel Krynicki <pawel.krynicki [at] xsolve [dot] pl>
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+<?php
+
+$result = http_build_query(null);
+
+?>
+--EXPECTF--
+Warning: http_build_query(): Parameter 1 expected to be Array or Object. %s value given in %s on line %d \ No newline at end of file