Skip to content

Commit

Permalink
fixed arrayaccess implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
pulse00 committed May 21, 2015
1 parent 26f9dcb commit 2ef5474
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Dubture/Monolog/Reader/LogReader.php
Expand Up @@ -69,7 +69,7 @@ public function setParser(LogParserInterface $parser)
*/
public function offsetExists($offset)
{
return $this->lineCount >= $offset;
return $offset < $this->lineCount;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions tests/Dubture/Monolog/Reader/Test/LogReaderTest.php
Expand Up @@ -45,11 +45,18 @@ public function testReader()

public function testIterator()
{
// the test.log file contains 2 log lines
$file = __DIR__ . '/../../../../files/test.log';
$reader = new LogReader($file);
$lines = array();
$keys = array();

$this->assertTrue($reader->offsetExists(0));
$this->assertTrue($reader->offsetExists(1));

$this->assertFalse($reader->offsetExists(2));
$this->assertFalse($reader->offsetExists(3));

$this->assertEquals(2, count($reader));

foreach ($reader as $i => $log) {
Expand Down

0 comments on commit 2ef5474

Please sign in to comment.