From 4e000a09a9dda0be015fcd85d126716c2ff6a108 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Tue, 27 Aug 2024 19:37:15 +0700 Subject: [PATCH] Fix tests --- tests/Support/Stub/ColumnFactory.php | 29 +++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/Support/Stub/ColumnFactory.php b/tests/Support/Stub/ColumnFactory.php index dc92c9ac8..e1d4f58a5 100644 --- a/tests/Support/Stub/ColumnFactory.php +++ b/tests/Support/Stub/ColumnFactory.php @@ -5,11 +5,38 @@ namespace Yiisoft\Db\Tests\Support\Stub; use Yiisoft\Db\Schema\Column\AbstractColumnFactory; +use Yiisoft\Db\Schema\SchemaInterface; class ColumnFactory extends AbstractColumnFactory { protected function getType(string $dbType, array $info = []): string { - return $dbType; + return $this->isType($dbType) ? $dbType : SchemaInterface::TYPE_STRING; + } + + protected function isType(string $dbType): bool + { + return match ($dbType) { + SchemaInterface::TYPE_UUID, + SchemaInterface::TYPE_CHAR, + SchemaInterface::TYPE_STRING, + SchemaInterface::TYPE_TEXT, + SchemaInterface::TYPE_BINARY, + SchemaInterface::TYPE_BOOLEAN, + SchemaInterface::TYPE_TINYINT, + SchemaInterface::TYPE_SMALLINT, + SchemaInterface::TYPE_INTEGER, + SchemaInterface::TYPE_BIGINT, + SchemaInterface::TYPE_FLOAT, + SchemaInterface::TYPE_DOUBLE, + SchemaInterface::TYPE_DECIMAL, + SchemaInterface::TYPE_MONEY, + SchemaInterface::TYPE_DATETIME, + SchemaInterface::TYPE_TIMESTAMP, + SchemaInterface::TYPE_TIME, + SchemaInterface::TYPE_DATE, + SchemaInterface::TYPE_JSON => true, + default => false, + }; } }