From 471540611f88c577a69b210d93260e55d11fd334 Mon Sep 17 00:00:00 2001 From: Rasmus Schultz Date: Mon, 23 May 2016 14:02:00 +0200 Subject: [PATCH] add float type; needs test; closes #5 --- src/model/types/FloatType.php | 22 ++++++++++++++++++++++ src/mysql/MySQLDatabase.php | 3 +++ src/postgres/PostgresDatabase.php | 3 +++ test/test.php | 2 ++ 4 files changed, 30 insertions(+) create mode 100644 src/model/types/FloatType.php diff --git a/src/model/types/FloatType.php b/src/model/types/FloatType.php new file mode 100644 index 0000000..ededfc2 --- /dev/null +++ b/src/model/types/FloatType.php @@ -0,0 +1,22 @@ +container->alias("scalar.boolean", BoolType::class); + + $this->container->register("scalar.double", FloatType::class); } /** diff --git a/src/postgres/PostgresDatabase.php b/src/postgres/PostgresDatabase.php index 94ac421..e1bde2b 100644 --- a/src/postgres/PostgresDatabase.php +++ b/src/postgres/PostgresDatabase.php @@ -5,6 +5,7 @@ use mindplay\sql\model\Database; use mindplay\sql\model\schema\Table; use mindplay\sql\model\types\BoolType; +use mindplay\sql\model\types\FloatType; class PostgresDatabase extends Database { @@ -17,6 +18,8 @@ public function __construct() }); $this->container->alias("scalar.boolean", BoolType::class); + + $this->container->register("scalar.double", FloatType::class); } /** diff --git a/test/test.php b/test/test.php index b68e861..f82e0dd 100644 --- a/test/test.php +++ b/test/test.php @@ -1440,6 +1440,8 @@ function () { // TODO integration test for driver-generated SQLException-types +// TODO add test for FloatType + configure()->enableCodeCoverage(__DIR__ . '/build/clover.xml', dirname(__DIR__) . '/src'); exit(run());