1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/spl/tests/SplFileObject/SplFileObject_key_fgets_and_seek.phpt
George Peter Banyard fcba0a49fc Fix test file name to not include a whitespace
This breaks the preload file flag in the test runner
2022-05-31 11:28:01 +01:00

40 lines
667 B
PHP

--TEST--
SplFileObject verify interactions between seeking, getting the key and fgets
--FILE--
<?php
$file = new SplTempFileObject();
for ($i = 0; $i < 100; $i++) {
$file->fwrite("Foo $i\n");
}
$file->seek(50);
var_dump(
['line' => $file->key(), 'contents' => trim($file->fgets())],
['line' => $file->key(), 'contents' => trim($file->fgets())],
['line' => $file->key(), 'contents' => trim($file->fgets())],
);
?>
--EXPECT--
array(2) {
["line"]=>
int(50)
["contents"]=>
string(6) "Foo 50"
}
array(2) {
["line"]=>
int(51)
["contents"]=>
string(6) "Foo 51"
}
array(2) {
["line"]=>
int(52)
["contents"]=>
string(6) "Foo 52"
}