1--TEST--
2RecursiveDirectoryIterator::getBasePath() - basic test
3--CREDITS--
4Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
5#testfest AmsterdamPHP 2012-06-23
6--FILE--
7<?php
8$depth0 = "depth0";
9$depth1 = 'depth1';
10$depth2 = 'depth2';
11$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
12mkdir($targetDir, 0777, true);
13touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPath_test.tmp');
14$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
15$it = new RecursiveIteratorIterator($iterator);
16
17$list = [];
18while($it->valid()) {
19  $list[] = $it->getSubPath();
20  $it->next();
21}
22asort($list);
23foreach ($list as $item) {
24	echo $item . "\n";
25}
26?>
27--CLEAN--
28<?php
29function rrmdir($dir) {
30    foreach(glob($dir . '/*') as $file) {
31        if(is_dir($file)) {
32            rrmdir($file);
33        } else {
34            unlink($file);
35        }
36    }
37
38    rmdir($dir);
39}
40
41$targetDir = __DIR__.DIRECTORY_SEPARATOR . "depth0";
42rrmdir($targetDir);
43?>
44
45--EXPECTF--
46depth1
47depth1
48depth1%cdepth2
49depth1%cdepth2
50depth1%cdepth2
51