public function testEachLine() { $text = new Text("This is line1\n" . "This is line2\r\n" . "This is line3"); $text->eachLine(function (Text $line, $index) { return $line->prepend($index + 1 . ': '); }); $expected = "1: This is line1\n" . "2: This is line2\r\n" . "3: This is line3"; $this->assertEquals($expected, (string) $text); }