diff --git a/tests/methods/fixtures/auto-double-enclosure.csv b/tests/example_files/auto-double-enclosure.csv similarity index 100% rename from tests/methods/fixtures/auto-double-enclosure.csv rename to tests/example_files/auto-double-enclosure.csv diff --git a/tests/methods/fixtures/auto-single-enclosure.csv b/tests/example_files/auto-single-enclosure.csv similarity index 100% rename from tests/methods/fixtures/auto-single-enclosure.csv rename to tests/example_files/auto-single-enclosure.csv diff --git a/tests/methods/ParseTest.php b/tests/methods/ParseTest.php index 0752e30..abe30d8 100644 --- a/tests/methods/ParseTest.php +++ b/tests/methods/ParseTest.php @@ -94,4 +94,24 @@ class ParseTest extends PHPUnit\Framework\TestCase { ], ]; } + + public function autoQuotesDataProvider() { + return array( + array('tests/methods/fixtures/auto-double-enclosure.csv', '"'), + array('tests/methods/fixtures/auto-single-enclosure.csv', "'"), + ); + } + + /** + * @dataProvider autoQuotesDataProvider + * + * @param string $file + * @param string $enclosure + */ + public function testAutoQuotes($file, $enclosure) { + $csv = new parseCSV(); + $csv->auto($file, true, null, null, $enclosure); + $this->assertArrayHasKey('column1', $csv->data[0], 'Data parsed incorrectly with enclosure ' . $enclosure); + $this->assertEquals('value1', $csv->data[0]['column1'], 'Data parsed incorrectly with enclosure ' . $enclosure); + } } diff --git a/tests/methods/auto_test.php b/tests/methods/auto_test.php deleted file mode 100644 index 124a9ef..0000000 --- a/tests/methods/auto_test.php +++ /dev/null @@ -1,26 +0,0 @@ -auto($file, true, null, null, $enclosure); - $this->assertArrayHasKey('column1', $csv->data[0], 'Data parsed incorrectly with enclosure ' . $enclosure); - $this->assertEquals('value1', $csv->data[0]['column1'], 'Data parsed incorrectly with enclosure ' . $enclosure); - } -}