public function generate()
 {
     $fileTraversable = $this->createFileTraversable();
     $sampleTextIteratorFactory = new SampleTextLinesFactory($this->addAllSectionMarkers);
     $manuscriptLines = new \RecursiveIteratorIterator(new ManuscriptLines($fileTraversable, $sampleTextIteratorFactory));
     $writer = new FileLineWriter($this->filename);
     $writer->writeLines($manuscriptLines);
 }
 /**
  * @test
  */
 public function it_writes_all_values_from_an_iterator_to_a_file_as_lines()
 {
     $lines = new \ArrayIterator(array('Line 1', 'Line 2', ''));
     $this->writer->writeLines($lines);
     $this->assertSameFileContents("Line 1\nLine 2\n\n");
 }