1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/spl/tests/dit_006.phpt
Fabien Villepinte a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00

51 lines
750 B
PHP

--TEST--
SPL: DirectoryIterator and seek
--FILE--
<?php
$di = new DirectoryIterator(__DIR__."/..");
$di->seek(2);
$n = 0;
while ($di->valid()) {
$n++;
$di->next();
}
echo "With seek(2) we get $n\n";
$di->seek(0);
$m = 0;
while ($di->valid()) {
$m++;
$di->next();
}
echo "With seek(0) we get $m\n";
$o = 0;
$di->rewind();
while ($di->valid()) {
$o++;
$di->next();
}
echo "Without seek we get $o\n";
try {
$p = 0;
$di->seek($o+1);
$p = 1;
} catch (\OutOfBoundsException $ex) {
echo $ex->getMessage() . PHP_EOL;
}
var_dump($n !== $m, $m === $o, $p === 0);
?>
--EXPECTF--
With seek(2) we get %d
With seek(0) we get %d
Without seek we get %d
Seek position %d is out of range
bool(true)
bool(true)
bool(true)