| @@ 21-32 (lines=12) @@ | ||
| 18 | * @param string $csv |
|
| 19 | * @param array $tokens |
|
| 20 | */ |
|
| 21 | public function testTokeniser(CsvConfigurationInterface $config, $csv, array $tokens) |
|
| 22 | { |
|
| 23 | $tokeniser = new StreamTokeniser($config, $this->getStream($csv)); |
|
| 24 | ||
| 25 | $actual = iterator_to_array($tokeniser->getTokens()); |
|
| 26 | ||
| 27 | $tokensOnly = array_map(function (Token $token) { |
|
| 28 | return [$token->getType(), $token->getPosition(), $token->getLength(), $token->getContent()]; |
|
| 29 | }, $actual); |
|
| 30 | ||
| 31 | static::assertEquals($tokens, $tokensOnly); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param string $string |
|
| @@ 20-31 (lines=12) @@ | ||
| 17 | * @param string $csv |
|
| 18 | * @param array $tokens |
|
| 19 | */ |
|
| 20 | public function testTokeniser(CsvConfigurationInterface $config, $csv, array $tokens) |
|
| 21 | { |
|
| 22 | $tokeniser = new StringTokeniser($config, $csv); |
|
| 23 | ||
| 24 | $actual = iterator_to_array($tokeniser->getTokens()); |
|
| 25 | ||
| 26 | $tokensOnly = array_map(function (Token $token) { |
|
| 27 | return [$token->getType(), $token->getPosition(), $token->getLength(), $token->getContent()]; |
|
| 28 | }, $actual); |
|
| 29 | ||
| 30 | static::assertEquals($tokens, $tokensOnly); |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return array |
|