diff --git a/tests/methods/parse_test.php b/tests/methods/parse_test.php new file mode 100644 index 0000000..a9f9563 --- /dev/null +++ b/tests/methods/parse_test.php @@ -0,0 +1,41 @@ +csv = new parseCSV(); + } + + public function test_parse() { + // can we trick 'is_readable' into whining? See #67. + $this->parse_repetitive_string('c:/looks/like/a/path'); + $this->parse_repetitive_string('http://looks/like/an/url'); + } + + private function parse_repetitive_string($content) { + $this->csv->delimiter = ';'; + $this->csv->heading = FALSE; + $success = $this->csv->parse(str_repeat($content . ';', 500)); + $this->assertEquals(TRUE, $success); + + $row = array_pop($this->csv->data); + $expected_data = array_fill(0, 500, $content); + $expected_data [] = ''; + $this->assertEquals($expected_data, $row); + } +}