mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
parent
79b40ad573
commit
eadcc8dc93
3 changed files with 15 additions and 0 deletions
|
@ -95,6 +95,9 @@ class ReversedFileReader implements \Iterator
|
||||||
if ($this->pos == 0) {
|
if ($this->pos == 0) {
|
||||||
return array_pop($buffer);
|
return array_pop($buffer);
|
||||||
}
|
}
|
||||||
|
if (is_null($buffer)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (count($buffer) > 1) {
|
if (count($buffer) > 1) {
|
||||||
return array_pop($buffer);
|
return array_pop($buffer);
|
||||||
}
|
}
|
||||||
|
|
0
tests/datasets/log/empty.friendica.log.txt
Normal file
0
tests/datasets/log/empty.friendica.log.txt
Normal file
|
@ -145,4 +145,16 @@ class ParsedLogIteratorTest extends TestCase
|
||||||
$pls = iterator_to_array($this->pli, false);
|
$pls = iterator_to_array($this->pli, false);
|
||||||
self::assertCount(0, $pls);
|
self::assertCount(0, $pls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testEmptyLogFile()
|
||||||
|
{
|
||||||
|
$logfile = dirname(__DIR__) . '/../../datasets/log/empty.friendica.log.txt';
|
||||||
|
|
||||||
|
$reader = new ReversedFileReader();
|
||||||
|
$pli = new ParsedLogIterator($reader);
|
||||||
|
$pli->open($logfile);
|
||||||
|
|
||||||
|
$pls = iterator_to_array($pli, false);
|
||||||
|
self::assertCount(0, $pls);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue