xref: /PHP-5.6/ext/phar/tests/phar_oo_004U.phpt (revision 14d53417)
1--TEST--
2Phar and DirectoryIterator
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6if (!extension_loaded("spl")) die("skip SPL not available");
7if (version_compare(PHP_VERSION, "6.0", "<")) die("skip requires Unicode support");
8?>
9--INI--
10phar.require_hash=0
11--FILE--
12<?php
13
14require_once 'files/phar_oo_test.inc';
15
16$it = new DirectoryIterator('phar://'.$fname);
17
18foreach($it as $name => $ent)
19{
20	var_dump($name);
21	var_dump($ent->getFilename());
22	var_dump($ent->isDir());
23	var_dump($ent->isDot());
24}
25
26?>
27===MANUAL===
28<?php
29
30class MyDirectoryIterator extends DirectoryIterator
31{
32	function __construct($dir)
33	{
34		echo __METHOD__ . "\n";
35		parent::__construct($dir);
36	}
37
38	function rewind()
39	{
40		echo __METHOD__ . "\n";
41		parent::rewind();
42	}
43
44	function valid()
45	{
46		echo __METHOD__ . "\n";
47		return parent::valid();
48	}
49
50	function key()
51	{
52		echo __METHOD__ . "\n";
53		return parent::key();
54	}
55
56	function current()
57	{
58		echo __METHOD__ . "\n";
59		return parent::current();
60	}
61
62	function next()
63	{
64		echo __METHOD__ . "\n";
65		parent::next();
66	}
67}
68
69$it = new MyDirectoryIterator('phar://'.$fname);
70
71foreach($it as $name => $ent)
72{
73	var_dump($name);
74	var_dump($ent->getFilename());
75}
76
77?>
78===DONE===
79--CLEAN--
80<?php
81unlink(dirname(__FILE__) . '/files/phar_oo_004U.phar.php');
82__halt_compiler();
83?>
84--EXPECT--
85int(0)
86unicode(5) "a.php"
87bool(false)
88bool(false)
89int(1)
90unicode(1) "b"
91bool(true)
92bool(false)
93int(2)
94unicode(5) "b.php"
95bool(false)
96bool(false)
97int(3)
98unicode(5) "e.php"
99bool(false)
100bool(false)
101===MANUAL===
102MyDirectoryIterator::__construct
103MyDirectoryIterator::rewind
104MyDirectoryIterator::valid
105MyDirectoryIterator::current
106MyDirectoryIterator::key
107int(0)
108unicode(5) "a.php"
109MyDirectoryIterator::next
110MyDirectoryIterator::valid
111MyDirectoryIterator::current
112MyDirectoryIterator::key
113int(1)
114unicode(1) "b"
115MyDirectoryIterator::next
116MyDirectoryIterator::valid
117MyDirectoryIterator::current
118MyDirectoryIterator::key
119int(2)
120unicode(5) "b.php"
121MyDirectoryIterator::next
122MyDirectoryIterator::valid
123MyDirectoryIterator::current
124MyDirectoryIterator::key
125int(3)
126unicode(5) "e.php"
127MyDirectoryIterator::next
128MyDirectoryIterator::valid
129===DONE===
130