| @@ 112-121 (lines=10) @@ | ||
| 109 | * @covers TextFile\Walker\SimpleWalker::goBeforeCharacter |
|
| 110 | * @expectedException \TextFile\Exception\OutOfBoundsException |
|
| 111 | */ |
|
| 112 | public function testGoBeforeCharacterTooLow() |
|
| 113 | { |
|
| 114 | $filePath = $this->createTestFileFromFixtures('simple_multiline_file.txt'); |
|
| 115 | ||
| 116 | $file = new \SplFileObject($filePath, 'r+'); |
|
| 117 | ||
| 118 | $walker = new SimpleWalker(); |
|
| 119 | ||
| 120 | $walker->goBeforeCharacter($file, -1); |
|
| 121 | } |
|
| 122 | ||
| 123 | /** |
|
| 124 | * @covers TextFile\Walker\SimpleWalker::goBeforeCharacter |
|
| @@ 127-136 (lines=10) @@ | ||
| 124 | * @covers TextFile\Walker\SimpleWalker::goBeforeCharacter |
|
| 125 | * @expectedException \TextFile\Exception\OutOfBoundsException |
|
| 126 | */ |
|
| 127 | public function testGoBeforeCharacterTooHigh() |
|
| 128 | { |
|
| 129 | $filePath = $this->createTestFileFromFixtures('simple_multiline_file.txt'); |
|
| 130 | ||
| 131 | $file = new \SplFileObject($filePath, 'r+'); |
|
| 132 | ||
| 133 | $walker = new SimpleWalker(); |
|
| 134 | ||
| 135 | $walker->goBeforeCharacter($file, $file->getSize() + 1); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| @@ 37-45 (lines=9) @@ | ||
| 34 | * |
|
| 35 | * @expectedException \TextFile\Exception\OutOfBoundsException |
|
| 36 | */ |
|
| 37 | public function testGetLinesRangeOutOfBoundsTooLow() |
|
| 38 | { |
|
| 39 | $reader = new SimpleReader(new SimpleWalker()); |
|
| 40 | ||
| 41 | $filePath = $this->createTestFileFromFixtures('complex_multiline_file.txt'); |
|
| 42 | $file = new \SplFileObject($filePath, 'r+'); |
|
| 43 | ||
| 44 | $reader->getLinesRange($file, -1, 2); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * @covers TextFile\Reader\SimpleReader::getLinesRange |
|
| @@ 52-60 (lines=9) @@ | ||
| 49 | * |
|
| 50 | * @expectedException \TextFile\Exception\OutOfBoundsException |
|
| 51 | */ |
|
| 52 | public function testGetLinesRangeOutOfBoundsTooHigh() |
|
| 53 | { |
|
| 54 | $reader = new SimpleReader(new SimpleWalker()); |
|
| 55 | ||
| 56 | $filePath = $this->createTestFileFromFixtures('complex_multiline_file.txt'); |
|
| 57 | $file = new \SplFileObject($filePath, 'r+'); |
|
| 58 | ||
| 59 | $reader->getLinesRange($file, 0, 20); |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @covers TextFile\Reader\SimpleReader::getNextLineContent |
|
| @@ 103-113 (lines=11) @@ | ||
| 100 | * |
|
| 101 | * @expectedException \TextFile\Exception\OutOfBoundsException |
|
| 102 | */ |
|
| 103 | public function testGetNextLineContentOutOfBounds() |
|
| 104 | { |
|
| 105 | $reader = new SimpleReader(new SimpleWalker()); |
|
| 106 | ||
| 107 | $filePath = $this->createTestFileFromFixtures('complex_multiline_file.txt'); |
|
| 108 | $file = new \SplFileObject($filePath, 'r+'); |
|
| 109 | ||
| 110 | $file->seek(5); |
|
| 111 | ||
| 112 | $reader->getNextLineContent($file); |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * @covers TextFile\Reader\SimpleReader::getPreviousLineContent |
|
| @@ 139-149 (lines=11) @@ | ||
| 136 | * |
|
| 137 | * @expectedException \TextFile\Exception\OutOfBoundsException |
|
| 138 | */ |
|
| 139 | public function testGetPreviousLineContentOutOfBounds() |
|
| 140 | { |
|
| 141 | $reader = new SimpleReader(new SimpleWalker()); |
|
| 142 | ||
| 143 | $filePath = $this->createTestFileFromFixtures('complex_multiline_file.txt'); |
|
| 144 | $file = new \SplFileObject($filePath, 'r+'); |
|
| 145 | ||
| 146 | $file->seek(0); |
|
| 147 | ||
| 148 | $reader->getPreviousLineContent($file); |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * @covers TextFile\Reader\SimpleReader::getCurrentLineContent |
|