Added tests for files starting with a byte order mark (BOM)

This commit is contained in:
Christian Bläul
2017-11-25 12:33:09 +01:00
committed by Fonata
parent 7536d55f27
commit b082849b17
3 changed files with 15 additions and 0 deletions

Binary file not shown.
1 sep=;
2 title;isbn;publishedAt
3 Красивая кулинария;5454-5587-3210;21.05.2011
4 The Wine Connoisseurs;2547-8548-2541;12.12.2011
5 Weißwein;1313-4545-8875;23.02.2012

View File

@@ -0,0 +1,5 @@
sep=;
title;isbn;publishedAt
Красивая кулинария;5454-5587-3210;21.05.2011
The Wine Connoisseurs;2547-8548-2541;12.12.2011
Weißwein;1313-4545-8875;23.02.2012
1 sep=;
2 title;isbn;publishedAt
3 Красивая кулинария;5454-5587-3210;21.05.2011
4 The Wine Connoisseurs;2547-8548-2541;12.12.2011
5 Weißwein;1313-4545-8875;23.02.2012

View File

@@ -44,6 +44,16 @@ class parse_test extends PHPUnit\Framework\TestCase {
$this->assertEquals($this->_get_magazines_data(), $this->csv->data);
}
public function test_sep_row_auto_detection_UTF8() {
$this->csv->auto(__DIR__ . '/../example_files/UTF-8_with_BOM_and_sep_row.csv');
$this->assertEquals($this->_get_magazines_data(), $this->csv->data);
}
public function test_sep_row_auto_detection_UTF16() {
$this->csv->auto(__DIR__ . '/../example_files/UTF-16LE_with_BOM_and_sep_row.csv');
$this->assertEquals($this->_get_magazines_data(), $this->csv->data);
}
public function test_single_column() {
$this->csv->auto(__DIR__ . '/../example_files/single_column.csv');
$expected = [