Annotation of embedaddon/php/ext/spl/tests/dit_006.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: SPL: DirectoryIterator and seek
                      3: --FILE--
                      4: <?php
                      5: $di = new DirectoryIterator(__DIR__);
                      6: $di->seek(2);
                      7: 
                      8: $n = 0;
                      9: while ($di->valid()) {
                     10:     $n++;
                     11:     $di->next();
                     12: }
                     13: 
                     14: echo "With seek(2) we get $n\n";
                     15: $di->seek(0);
                     16: 
                     17: $m = 0;
                     18: while ($di->valid()) {
                     19:     $m++;
                     20:     $di->next();
                     21: }
                     22: echo "With seek(0) we get $m\n";
                     23: 
                     24: $o = 0;
                     25: $di->rewind();
                     26: while ($di->valid()) {
                     27:     $o++;
                     28:     $di->next();
                     29: }
                     30: 
                     31: echo "Without seek we get $o\n";
                     32: 
                     33: $p = 0;
                     34: $di->seek($o+1);
                     35: while ($di->valid()) {
                     36:     $p++;
                     37:     $di->next();
                     38: }
                     39: 
                     40: var_dump($n !== $m, $m === $o, $p === 0);
                     41: ?>
                     42: ===DONE===
                     43: --EXPECTF--
                     44: With seek(2) we get %d
                     45: With seek(0) we get %d
                     46: Without seek we get %d
                     47: bool(true)
                     48: bool(true)
                     49: bool(true)
                     50: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>