diff --git a/src/Text.php b/src/Text.php index 50c7e28..4cd05b7 100644 --- a/src/Text.php +++ b/src/Text.php @@ -54,7 +54,7 @@ public function getChar($position = self::CURRENT_POSITION) throw new Exception('Position is not int. ' . gettype($position)); } - if ($this->eof()) { + if ($this->eof($position)) { throw new Exception('Index out of range. Position: ' . $position . '.'); } diff --git a/tests/TextTest.php b/tests/TextTest.php index 6873839..5bc502a 100644 --- a/tests/TextTest.php +++ b/tests/TextTest.php @@ -13,6 +13,15 @@ class TextTest extends \PHPUnit_Framework_TestCase { + /** + * @expectedException \RomanPitak\Nginx\Config\Exception + */ + public function testEolErr() + { + $text = new Text('This is a line for testing...'); + $text->eol(30); + } + /** * @expectedException \RomanPitak\Nginx\Config\Exception */