Skip to content

Commit

Permalink
Add test for partial mapping of indexed cols
Browse files Browse the repository at this point in the history
  • Loading branch information
emohamed committed Sep 15, 2017
1 parent e330090 commit df2d0be
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/CsvFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,30 @@ function test_map_partial_columns() {
],
], $csv->to_array() );
}

function test_map_partial_indecies_columns() {
$csv = new CsvFile(__DIR__ . '/../sample-data/info-no-head-row.csv');
$csv->set_column_names([
1 => 'lname',
3 => 'address',
]);
$this->assertEquals( [
[
'lname' => 'Doe',
'address' => 'Some Address 2, 12345, Country A',
],
[
'lname' => 'Dove',
'address' => 'That Address 3, 456, Country B',
],
[
'lname' => 'Smith',
'address' => '',
],
[
'lname' => 'Smith',
'address' => 'This Address 4, City, Country C',
],
], $csv->to_array() );
}
}

0 comments on commit df2d0be

Please sign in to comment.