Skip to content

Commit ee172ce

Browse files
committed
Merging PR #116
1 parent aa133ea commit ee172ce

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
--TEST--
2+
RecursiveDirectoryIterator::getBasePath() - basic test
3+
--CREDITS--
4+
Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
5+
#testfest AmsterdamPHP 2012-06-23
6+
--FILE--
7+
<?php
8+
$depth0 = md5('recursiveDirectoryIterator::getSubPath');
9+
$depth1 = md5('depth1');
10+
$depth2 = md5('depth2');
11+
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
12+
mkdir($targetDir, 0777, true);
13+
touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPath_test.tmp');
14+
$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
15+
$it = new RecursiveIteratorIterator($iterator);
16+
17+
$list = [];
18+
while($it->valid()) {
19+
$list[] = $it->getSubPath();
20+
$it->next();
21+
}
22+
asort($list);
23+
foreach ($list as $item) {
24+
echo $item . "\n";
25+
}
26+
?>
27+
==DONE==
28+
--CLEAN--
29+
<?php
30+
function rrmdir($dir) {
31+
foreach(glob($dir . '/*') as $file) {
32+
if(is_dir($file)) {
33+
rrmdir($file);
34+
} else {
35+
unlink($file);
36+
}
37+
}
38+
39+
rmdir($dir);
40+
}
41+
42+
$targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('recursiveDirectoryIterator::getSubPath');
43+
rrmdir($targetDir);
44+
?>
45+
46+
--EXPECT--
47+
a0c967a6c2c34786e4802f59af9356f5
48+
a0c967a6c2c34786e4802f59af9356f5
49+
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
50+
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
51+
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
52+
==DONE==
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
--TEST--
2+
RecursiveDirectoryIterator::getBasePathname() - basic test
3+
--CREDITS--
4+
Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
5+
#testfest AmsterdamPHP 2012-06-23
6+
--FILE--
7+
<?php
8+
$depth0 = md5('recursiveDirectoryIterator::getSubPathname');
9+
$depth1 = md5('depth1');
10+
$depth2 = md5('depth2');
11+
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
12+
mkdir($targetDir, 0777, true);
13+
touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPathname_test_2.tmp');
14+
touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . 'getSubPathname_test_3.tmp');
15+
touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 'getSubPathname_test_1.tmp');
16+
$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
17+
$it = new RecursiveIteratorIterator($iterator);
18+
19+
$list = [];
20+
while($it->valid()) {
21+
$list[] = $it->getSubPathname();
22+
$it->next();
23+
}
24+
asort($list);
25+
foreach ($list as $item) {
26+
echo $item . "\n";
27+
}
28+
?>
29+
==DONE==
30+
--CLEAN--
31+
<?php
32+
function rrmdir($dir) {
33+
foreach(glob($dir . '/*') as $file) {
34+
if(is_dir($file)) {
35+
rrmdir($file);
36+
} else {
37+
unlink($file);
38+
}
39+
}
40+
41+
rmdir($dir);
42+
}
43+
44+
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . md5('recursiveDirectoryIterator::getSubPathname');
45+
rrmdir($targetDir);
46+
?>
47+
--EXPECT--
48+
.
49+
.
50+
..
51+
a0c967a6c2c34786e4802f59af9356f5/.
52+
a0c967a6c2c34786e4802f59af9356f5/..
53+
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/.
54+
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/..
55+
a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/getSubPathname_test_2.tmp
56+
a0c967a6c2c34786e4802f59af9356f5/getSubPathname_test_3.tmp
57+
getSubPathname_test_1.tmp
58+
==DONE==
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Testing error on null parameter 1 of http_build_query()
3+
--CREDITS--
4+
Pawel Krynicki <pawel.krynicki [at] xsolve [dot] pl>
5+
#testfest AmsterdamPHP 2012-06-23
6+
--FILE--
7+
<?php
8+
9+
$result = http_build_query(null);
10+
11+
?>
12+
--EXPECTF--
13+
Warning: http_build_query(): Parameter 1 expected to be Array or Object. %s value given in %s on line %d

0 commit comments

Comments
 (0)