Skip to content

Commit 8029865

Browse files
authored
Merge pull request #102 from aaronhuisinga/master
Add test file for DBase 7 Double type
2 parents bc5cdf2 + faffe70 commit 8029865

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/XBase/Record/DBase7Record.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ public function getInt(string $columnName): int
3434
{
3535
return $this->get($columnName);
3636
}
37+
38+
/**
39+
* @deprecated since 1.3 and will be delete in 2.0. Use get()
40+
*/
41+
public function getDouble(string $columnName): float
42+
{
43+
return $this->get($columnName);
44+
}
3745
}

tests/DBaseTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,20 @@ public function testDbase7int(): void
383383
self::assertSame(2147483647, $table->nextRecord()->getInt('int'));
384384
self::assertSame(-2147483647, $table->nextRecord()->getInt('int'));
385385
}
386+
387+
public function testDbase7double(): void
388+
{
389+
$table = new Table(__DIR__.'/Resources/dBase/dBaseVII_double.dbf');
390+
self::assertSame(1, $table->getColumnCount());
391+
self::assertSame(5, $table->getRecordCount());
392+
self::assertSame(TableType::DBASE_7_NOMEMO, $table->getVersion());
393+
394+
self::assertSame(-199.99, $table->nextRecord()->getDouble('double'));
395+
self::assertSame(-74.62, $table->nextRecord()->getDouble('double'));
396+
self::assertSame(43.65, $table->nextRecord()->getDouble('double'));
397+
self::assertSame(150.48, $table->nextRecord()->getDouble('double'));
398+
self::assertSame(0.0, $table->nextRecord()->getDouble('double'));
399+
}
386400

387401
protected function assertMemoImg(Table $table)
388402
{
163 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)