Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 protected function build()
 {
     try {
         $this->row = $this->parser->parse(new State());
     } catch (ParsingFinishedException $e) {
         $this->finish();
     }
 }
Beispiel #2
0
 /**
  * @dataProvider getParseTestData
  */
 public function testParse($content, array $result)
 {
     $reader = new Reader();
     $reader->open(fopen('data://text/plain;base64,' . base64_encode($content), 'r'));
     $parser = new Parser(new TokenIterator(new Tokenizer(',', new Enclosure('|')), $reader));
     $rowIndex = -1;
     foreach ($result as $rowIndex => $values) {
         $found = $parser->parse(new State());
         foreach ($values as $cellIndex => $value) {
             $this->assertEquals($value, $found[$cellIndex]);
         }
         $this->assertEquals(count($values), count($found));
     }
     $this->assertEquals(count($result), $rowIndex + 1);
 }