Skip to content

Commit

Permalink
columns option tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gam6itko committed Mar 21, 2021
1 parent 72e0736 commit 9d080ea
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/TableReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,34 @@ public function testDbase7double(): void
self::assertSame(0.0, $table->nextRecord()->get('double'));
}

public function testColumnsOptions(): void
{
$table = new TableReader(__DIR__.'/Resources/dBase/dBaseVII.dbf', [
'columns' => ['name', 'money'],
]);

self::assertCount(2, $table->getColumns());

$record = $table->nextRecord();
self::assertSame('Groot', $record->get('name'));
self::assertSame(12.1235, $record->get('money'));
}

/**
* You cannot get data from unspecified columns.
*/
public function testColumnsOptionsFail(): void
{
self::expectException(\Exception::class);

$table = new TableReader(__DIR__.'/Resources/dBase/dBaseVII.dbf', [
'columns' => ['name', 'money'],
]);

$record = $table->nextRecord();
self::assertSame('Groot', $record->get('bio'));
}

protected function assertMemoImg(TableReader $table)
{
$record = $table->moveTo(1);
Expand Down

0 comments on commit 9d080ea

Please sign in to comment.