diff --git a/src/XBase/Record/DBase7Record.php b/src/XBase/Record/DBase7Record.php index ba82423..998a848 100644 --- a/src/XBase/Record/DBase7Record.php +++ b/src/XBase/Record/DBase7Record.php @@ -34,4 +34,12 @@ public function getInt(string $columnName): int { return $this->get($columnName); } + + /** + * @deprecated since 1.3 and will be delete in 2.0. Use get() + */ + public function getDouble(string $columnName): float + { + return $this->get($columnName); + } } diff --git a/tests/DBaseTest.php b/tests/DBaseTest.php index 0dc890a..f54d142 100644 --- a/tests/DBaseTest.php +++ b/tests/DBaseTest.php @@ -383,6 +383,20 @@ public function testDbase7int(): void self::assertSame(2147483647, $table->nextRecord()->getInt('int')); self::assertSame(-2147483647, $table->nextRecord()->getInt('int')); } + + public function testDbase7double(): void + { + $table = new Table(__DIR__.'/Resources/dBase/dBaseVII_double.dbf'); + self::assertSame(1, $table->getColumnCount()); + self::assertSame(5, $table->getRecordCount()); + self::assertSame(TableType::DBASE_7_NOMEMO, $table->getVersion()); + + self::assertSame(-199.99, $table->nextRecord()->getDouble('double')); + self::assertSame(-74.62, $table->nextRecord()->getDouble('double')); + self::assertSame(43.65, $table->nextRecord()->getDouble('double')); + self::assertSame(150.48, $table->nextRecord()->getDouble('double')); + self::assertSame(0.0, $table->nextRecord()->getDouble('double')); + } protected function assertMemoImg(Table $table) { diff --git a/tests/Resources/dBase/dBaseVII_double.dbf b/tests/Resources/dBase/dBaseVII_double.dbf new file mode 100755 index 0000000..c08ac41 Binary files /dev/null and b/tests/Resources/dBase/dBaseVII_double.dbf differ