diff --git a/tests/ColumnSchemaTest.php b/tests/ColumnSchemaTest.php index 6bd676bf..45191562 100644 --- a/tests/ColumnSchemaTest.php +++ b/tests/ColumnSchemaTest.php @@ -35,6 +35,7 @@ public function testPhpTypeCast(): void 'blob_col' => "\x10\x11\x12", 'timestamp_col' => '2023-07-11 14:50:23', 'bool_col' => false, + 'bit_col' => 0b0110_0110, // 102 ] ); $command->execute(); @@ -49,6 +50,7 @@ public function testPhpTypeCast(): void $blobColPhpType = $tableSchema->getColumn('blob_col')?->phpTypecast($query['blob_col']); $timestampColPhpType = $tableSchema->getColumn('timestamp_col')?->phpTypecast($query['timestamp_col']); $boolColPhpType = $tableSchema->getColumn('bool_col')?->phpTypecast($query['bool_col']); + $bitColPhpType = $tableSchema->getColumn('bit_col')?->phpTypecast($query['bit_col']); $this->assertSame(1, $intColPhpType); $this->assertSame(str_repeat('x', 100), $charColPhpType); @@ -57,6 +59,7 @@ public function testPhpTypeCast(): void $this->assertSame("\x10\x11\x12", $blobColPhpType); $this->assertSame('2023-07-11 14:50:23', $timestampColPhpType); $this->assertFalse($boolColPhpType); + $this->assertSame(0b0110_0110, $bitColPhpType); $db->close(); } diff --git a/tests/Provider/SchemaProvider.php b/tests/Provider/SchemaProvider.php index 81d20231..6c76af51 100644 --- a/tests/Provider/SchemaProvider.php +++ b/tests/Provider/SchemaProvider.php @@ -209,6 +209,19 @@ public static function columns(): array 'scale' => null, 'defaultValue' => new Expression('CURRENT_TIMESTAMP'), ], + 'bit_col' => [ + 'type' => 'smallint', + 'dbType' => 'bit(8)', + 'phpType' => 'integer', + 'primaryKey' => false, + 'allowNull' => false, + 'autoIncrement' => false, + 'enumValues' => null, + 'size' => 8, + 'precision' => 8, + 'scale' => null, + 'defaultValue' => 0b1000_0010, // 130 + ], ], 'tableName' => 'type', ], diff --git a/tests/Support/Fixture/sqlite.sql b/tests/Support/Fixture/sqlite.sql index f8d503a0..611ce606 100644 --- a/tests/Support/Fixture/sqlite.sql +++ b/tests/Support/Fixture/sqlite.sql @@ -131,7 +131,8 @@ CREATE TABLE "type" ( timestamp_col timestamp NOT NULL DEFAULT '2002-01-01 00:00:00', bool_col tinyint(1) NOT NULL, bool_col2 tinyint(1) DEFAULT '1', - ts_default TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + ts_default TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + bit_col BIT(8) NOT NULL DEFAULT 130 -- 0b1000_0010 ); CREATE TABLE "type_bit" (