diff --git a/tests/methods/ParseTest.php b/tests/methods/ParseTest.php index d941f40..291f81e 100644 --- a/tests/methods/ParseTest.php +++ b/tests/methods/ParseTest.php @@ -128,6 +128,24 @@ class ParseTest extends PHPUnit\Framework\TestCase { ], $aCity); } + /** + * @depends testSepRowAutoDetection + */ + public function testGetColumnDatatypes() { + $this->csv->auto('tests/methods/fixtures/datatype.csv'); + $this->csv->getDatatypes(); + $expected = [ + 'title' => 'string', + 'isbn' => 'string', + 'publishedAt' => 'date', + 'published' => 'boolean', + 'count' => 'integer', + 'price' => 'float' + ]; + + $this->assertEquals($expected, $this->csv->data_types); + } + protected function _get_magazines_data() { return [ [ diff --git a/tests/methods/fixtures/datatype.csv b/tests/methods/fixtures/datatype.csv new file mode 100644 index 0000000..ef367b0 --- /dev/null +++ b/tests/methods/fixtures/datatype.csv @@ -0,0 +1,5 @@ +sep=; +title;isbn;publishedAt;published;count;price; +Красивая кулинария;5454-5587-3210;21.05.2011;true;1;10.99 +The Wine Connoisseurs;2547-8548-2541;12.12.2011;TRUE;;20,33 +Weißwein;1313-4545-8875;23.02.2012;false;10;10