1--TEST--
2RecursiveDirectoryIterator::getBasePathname() - 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 . 'getSubPathname_test_2.tmp');
14touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . 'getSubPathname_test_3.tmp');
15touch(__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$it->rewind(); //see https://bugs.php.net/bug.php?id=62914
21while($it->valid()) {
22  $list[] = $it->getSubPathname();
23  $it->next();
24}
25asort($list);
26foreach ($list as $item) {
27	echo $item . "\n";
28}
29?>
30--CLEAN--
31<?php
32function 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 . "depth0";
45rrmdir($targetDir);
46?>
47--EXPECTF--
48.
49..
50depth1%c.
51depth1%c..
52depth1%cdepth2%c.
53depth1%cdepth2%c..
54depth1%cdepth2%cgetSubPathname_test_2.tmp
55depth1%cgetSubPathname_test_3.tmp
56getSubPathname_test_1.tmp
57