helly           Mon Feb  6 01:28:12 2006 UTC

  Added files:                 (Branch: PHP_5_1)
    /php-src/ext/spl/tests      array_020.phpt bug36287.phpt 
  Log:
  - MFH Add new tests
  

http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/tests/array_020.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/array_020.phpt
+++ php-src/ext/spl/tests/array_020.phpt
--TEST--
SPL: ArrayIterator overloading
--SKIPIF--
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php

class ArrayIteratorEx extends ArrayIterator
{
        function rewind()
        {
                echo __METHOD__ . "\n";
                ArrayIterator::rewind();
        }

        function valid()
        {
                echo __METHOD__ . "\n";
                return ArrayIterator::valid();
        }

        function key()
        {
                echo __METHOD__ . "\n";
                return ArrayIterator::key();
        }

        function current()
        {
                echo __METHOD__ . "\n";
                return ArrayIterator::current();
        }

        function next()
        {
                echo __METHOD__ . "\n";
                return ArrayIterator::next();
        }
}

$ar = new ArrayIteratorEx(array(1,2));
foreach($ar as $k => $v)
{
        var_dump($k);
        var_dump($v);
}

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
ArrayIteratorEx::rewind
ArrayIteratorEx::valid
ArrayIteratorEx::current
ArrayIteratorEx::key
int(0)
int(1)
ArrayIteratorEx::next
ArrayIteratorEx::valid
ArrayIteratorEx::current
ArrayIteratorEx::key
int(1)
int(2)
ArrayIteratorEx::next
ArrayIteratorEx::valid
===DONE===

http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/tests/bug36287.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug36287.phpt
+++ php-src/ext/spl/tests/bug36287.phpt
--TEST--
Bug #36287
--FILE--
<?php

$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."), true);

$idx = 0;
foreach($it as $file)
{
        echo "First\n";
        if("." != $file && ".." != $file)
        {
                var_Dump($file->getFilename());
        }
        echo "Second\n";
        if($file != "." && $file != "..")
        {
                var_dump($file->getFilename());
        }
        if (++$idx > 1)
        {
                break;
        }
}

?>
===DONE===
--EXPECTF--
First
string(%d) "%s"
Second
string(%d) "%s"
First
string(%d) "%s"
Second
string(%d) "%s"
===DONE===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to