mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
added two tests for reproducing the heading and offset bug. test with heading fails at the moment. if this one is green, bug would be solved
This commit is contained in:
@@ -157,6 +157,31 @@ class ParseTest extends TestCase
|
|||||||
$this->assertEquals($expected, $this->csv->data_types);
|
$this->assertEquals($expected, $this->csv->data_types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testDataArrayKeysWhenSettingOffsetWithHeading() {
|
||||||
|
$this->csv->offset = 2;
|
||||||
|
$this->csv->auto(__DIR__ . '/fixtures/datatype.csv');
|
||||||
|
$expected = [
|
||||||
|
'title',
|
||||||
|
'isbn',
|
||||||
|
'publishedAt',
|
||||||
|
'published',
|
||||||
|
'count',
|
||||||
|
'price'
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->assertEquals($expected, array_keys($this->csv->data[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDataArrayKeysWhenSettingOffsetWithoutHeading() {
|
||||||
|
$this->csv->heading = false;
|
||||||
|
$this->csv->offset = 2;
|
||||||
|
$this->csv->auto(__DIR__ . '/fixtures/datatype.csv');
|
||||||
|
$expected = range(0,5, 1);
|
||||||
|
|
||||||
|
$this->assertEquals($expected, array_keys($this->csv->data[0]));
|
||||||
|
}
|
||||||
|
|
||||||
protected function _get_magazines_data() {
|
protected function _get_magazines_data() {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user