Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Aug 27, 2024
1 parent 77a3677 commit 4e000a0
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/Support/Stub/ColumnFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
}

0 comments on commit 4e000a0

Please sign in to comment.