Allow _guess_delimiter to work with a single row of data

Fix #206
This commit is contained in:
Fonata
2021-10-16 18:28:19 +02:00
committed by Fonata
parent d5606f8b2a
commit 5d4643b201
3 changed files with 11 additions and 1 deletions

View File

@@ -121,6 +121,15 @@ class ParseTest extends TestCase {
self::assertEquals($expected, $this->csv->data);
}
public function testSingleRow() {
$this->csv->auto(__DIR__ . '/../example_files/single_row.csv');
self::assertEquals([], $this->csv->data, 'Single row is detected as header');
$this->csv->heading = false;
$this->csv->auto(__DIR__ . '/../example_files/single_row.csv');
$expected = [['C1', 'C2', 'C3']];
self::assertEquals($expected, $this->csv->data);
}
public function testMatomoData() {
// Matomo (Piwik) export cannot be read with
$this->csv->use_mb_convert_encoding = true;