From bd2031582d8ae08e12c49f71d55296dd169431c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Bl=C3=A4ul?= Date: Fri, 3 Nov 2017 21:28:00 +0100 Subject: [PATCH] Added 'single_row' test data for issue #99 Took example documented in #100. Thanks, @tunecino! --- tests/example_files/single_row.csv | 5 +++++ tests/methods/parse_test.php | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tests/example_files/single_row.csv diff --git a/tests/example_files/single_row.csv b/tests/example_files/single_row.csv new file mode 100644 index 0000000..3f2fd04 --- /dev/null +++ b/tests/example_files/single_row.csv @@ -0,0 +1,5 @@ +SMS +0444 +5555 +6606 +7777 \ No newline at end of file diff --git a/tests/methods/parse_test.php b/tests/methods/parse_test.php index a9f9563..17e54de 100644 --- a/tests/methods/parse_test.php +++ b/tests/methods/parse_test.php @@ -29,13 +29,25 @@ class parse_test extends PHPUnit_Framework_TestCase { private function parse_repetitive_string($content) { $this->csv->delimiter = ';'; - $this->csv->heading = FALSE; + $this->csv->heading = false; $success = $this->csv->parse(str_repeat($content . ';', 500)); - $this->assertEquals(TRUE, $success); + $this->assertEquals(true, $success); $row = array_pop($this->csv->data); $expected_data = array_fill(0, 500, $content); $expected_data [] = ''; $this->assertEquals($expected_data, $row); } + + public function test_single_row() { + $this->csv->auto(__DIR__ . '/../example_files/single_row.csv'); + $expected = [ + ['SMS' => '0444'], + ['SMS' => '5555'], + ['SMS' => '6606'], + ['SMS' => '7777'], + ]; + + $this->assertEquals($expected, $this->csv->data); + } }