diff --git a/tests/ColumnSchemaTest.php b/tests/ColumnSchemaTest.php index d745cb9b..24daf608 100644 --- a/tests/ColumnSchemaTest.php +++ b/tests/ColumnSchemaTest.php @@ -6,6 +6,7 @@ use Throwable; use Yiisoft\Db\Exception\Exception; +use Yiisoft\Db\Mysql\Column\ColumnBuilder; use Yiisoft\Db\Mysql\Tests\Support\TestTrait; use Yiisoft\Db\Query\Query; use Yiisoft\Db\Schema\Column\BinaryColumnSchema; @@ -111,4 +112,32 @@ public function testColumnSchemaInstance(): void $this->assertInstanceOf(BooleanColumnSchema::class, $tableSchema->getColumn('bool_col')); $this->assertInstanceOf(JsonColumnSchema::class, $tableSchema->getColumn('json_col')); } + + public function testLongtextType(): void + { + $db = $this->getConnection(); + $command = $db->createCommand(); + + try { + $command->dropTable('text_type')->execute(); + } catch (Exception) { + } + + $command->createTable( + 'text_type', + [ + 'tinytext' => ColumnBuilder::text(63), + 'text' => ColumnBuilder::text(16_383), + 'mediumtext' => ColumnBuilder::text(4_194_303), + 'longtext' => ColumnBuilder::text(4_294_967_295), + ], + )->execute(); + + $table = $db->getSchema()->getTableSchema('text_type'); + + $this->assertSame('tinytext', $table->getColumn('tinytext')->getDbType()); + $this->assertSame('text', $table->getColumn('text')->getDbType()); + $this->assertSame('mediumtext', $table->getColumn('mediumtext')->getDbType()); + $this->assertSame('longtext', $table->getColumn('longtext')->getDbType()); + } }