Annotation of embedaddon/php/ext/phar/tests/phar_buildfromiterator3.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar::buildFromIterator() iterator, but object passed
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: --INI--
! 6: phar.require_hash=0
! 7: phar.readonly=0
! 8: --FILE--
! 9: <?php
! 10: class myIterator implements Iterator
! 11: {
! 12: var $a;
! 13: function __construct(array $a)
! 14: {
! 15: $this->a = $a;
! 16: }
! 17: function next() {
! 18: echo "next\n";
! 19: return next($this->a);
! 20: }
! 21: function current() {
! 22: echo "current\n";
! 23: return current($this->a);
! 24: }
! 25: function key() {
! 26: echo "key\n";
! 27: return key($this->a);
! 28: }
! 29: function valid() {
! 30: echo "valid\n";
! 31: return current($this->a);
! 32: }
! 33: function rewind() {
! 34: echo "rewind\n";
! 35: return reset($this->a);
! 36: }
! 37: }
! 38: try {
! 39: $phar = new Phar(dirname(__FILE__) . '/buildfromiterator.phar');
! 40: $phar->buildFromIterator(new myIterator(array()), new stdClass);
! 41: } catch (Exception $e) {
! 42: var_dump(get_class($e));
! 43: echo $e->getMessage() . "\n";
! 44: }
! 45: ?>
! 46: ===DONE===
! 47: --CLEAN--
! 48: <?php
! 49: unlink(dirname(__FILE__) . '/buildfromiterator.phar');
! 50: __HALT_COMPILER();
! 51: ?>
! 52: --EXPECTF--
! 53: Warning: Phar::buildFromIterator() expects parameter 2 to be %string, object given in %sphar_buildfromiterator3.php on line %d
! 54: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>