summaryrefslogtreecommitdiff
path: root/ext/phar/tests/phar_oo_004.phpt
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2008-05-12 21:03:49 +0000
committerSVN Migration <svn@php.net>2008-05-12 21:03:49 +0000
commit16b4d8e0e1108564fa042520171d9091af708d83 (patch)
treeed242b98e845ea9c045ad6e10b9e9a083b569dd5 /ext/phar/tests/phar_oo_004.phpt
parente35c45791383ac9337adcd37255895f396001557 (diff)
downloadphp-git-16b4d8e0e1108564fa042520171d9091af708d83.tar.gz
This commit was manufactured by cvs2svn to create branch 'PHP_5_3'.
Diffstat (limited to 'ext/phar/tests/phar_oo_004.phpt')
-rwxr-xr-xext/phar/tests/phar_oo_004.phpt126
1 files changed, 126 insertions, 0 deletions
diff --git a/ext/phar/tests/phar_oo_004.phpt b/ext/phar/tests/phar_oo_004.phpt
new file mode 100755
index 0000000000..4f72b3678d
--- /dev/null
+++ b/ext/phar/tests/phar_oo_004.phpt
@@ -0,0 +1,126 @@
+--TEST--
+Phar and DirectoryIterator
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
+--INI--
+phar.require_hash=0
+--FILE--
+<?php
+
+require_once 'files/phar_oo_test.inc';
+
+$it = new DirectoryIterator('phar://'.$fname);
+
+foreach($it as $name => $ent)
+{
+ var_dump($name);
+ var_dump($ent->getFilename());
+ var_dump($ent->isDir());
+ var_dump($ent->isDot());
+}
+
+?>
+===MANUAL===
+<?php
+
+class MyDirectoryIterator extends DirectoryIterator
+{
+ function __construct($dir)
+ {
+ echo __METHOD__ . "\n";
+ parent::__construct($dir);
+ }
+
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
+
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
+
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
+}
+
+$it = new MyDirectoryIterator('phar://'.$fname);
+
+foreach($it as $name => $ent)
+{
+ var_dump($name);
+ var_dump($ent->getFilename());
+}
+
+?>
+===DONE===
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) . '/files/phar_oo_test.phar.php');
+__halt_compiler();
+?>
+--EXPECT--
+int(0)
+string(5) "a.php"
+bool(false)
+bool(false)
+int(1)
+string(1) "b"
+bool(true)
+bool(false)
+int(2)
+string(5) "b.php"
+bool(false)
+bool(false)
+int(3)
+string(5) "e.php"
+bool(false)
+bool(false)
+===MANUAL===
+MyDirectoryIterator::__construct
+MyDirectoryIterator::rewind
+MyDirectoryIterator::valid
+MyDirectoryIterator::current
+MyDirectoryIterator::key
+int(0)
+string(5) "a.php"
+MyDirectoryIterator::next
+MyDirectoryIterator::valid
+MyDirectoryIterator::current
+MyDirectoryIterator::key
+int(1)
+string(1) "b"
+MyDirectoryIterator::next
+MyDirectoryIterator::valid
+MyDirectoryIterator::current
+MyDirectoryIterator::key
+int(2)
+string(5) "b.php"
+MyDirectoryIterator::next
+MyDirectoryIterator::valid
+MyDirectoryIterator::current
+MyDirectoryIterator::key
+int(3)
+string(5) "e.php"
+MyDirectoryIterator::next
+MyDirectoryIterator::valid
+===DONE===