-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making the TabularDataReader getRecords optional argument a proper ma…
…pper
- Loading branch information
Showing
6 changed files
with
79 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -410,4 +410,17 @@ public function testExistsRecord(): void | |
self::assertFalse(Statement::create()->process($this->csv)->exists(fn (array $record) => array_key_exists('foobar', $record))); | ||
self::assertTrue(Statement::create()->process($this->csv)->exists(fn (array $record) => count($record) < 5)); | ||
} | ||
|
||
public function testHeaderMapperOnResultSet(): void | ||
{ | ||
$results = Statement::create() | ||
->process($this->csv) | ||
->getRecords([2 => 'e-mail', 1 => 'lastname', 33 => 'does not exists']); | ||
|
||
self::assertSame([ | ||
'e-mail' => '[email protected]', | ||
'lastname' => 'doe', | ||
'does not exists' => null, | ||
], [...$results][0]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,4 +144,16 @@ public function testOrderByWithEquity(): void | |
|
||
self::assertSame($this->expected, array_values([...$calculated])); | ||
} | ||
|
||
public function testHeaderMapperOnStatement(): void | ||
{ | ||
$results = Statement::create() | ||
->process($this->csv, [2 => 'e-mail', 1 => 'lastname', 33 => 'does not exists']); | ||
self::assertSame(['e-mail', 'lastname', 'does not exists'], $results->getHeader()); | ||
self::assertSame([ | ||
'e-mail' => '[email protected]', | ||
'lastname' => 'doe', | ||
'does not exists' => null, | ||
], $results->first()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters