Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Oct 26, 2023
1 parent fa3f9a1 commit 9dfab38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
7 changes: 3 additions & 4 deletions tests/AbstractQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,18 @@ public function testAddUnique(string $name, string $table, array|string $columns
$this->assertSame($expected, $sql);
}
/** @dataProvider \Yiisoft\Db\Tests\Provider\QueryBuilderProvider::columnTypes */
public function testAlterColumn(ColumnInterface|string $type): void
public function testAlterColumn(): void
{
$db = $this->getConnection();
$qb = $db->getQueryBuilder();
$sql = $qb->alterColumn('customer', 'email', $type);
$sql = $qb->alterColumn('customer', 'email', SchemaInterface::TYPE_STRING);
$this->assertSame(
DbHelper::replaceQuotes(
<<<SQL
ALTER TABLE [[customer]] CHANGE [[email]] [[email]]
SQL . ' ' . $qb->getColumnType($type),
SQL . ' ' . $qb->getColumnType(SchemaInterface::TYPE_STRING),
$db->getDriverName(),
),
$sql,
Expand Down
9 changes: 3 additions & 6 deletions tests/Db/Command/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,17 @@ public function testAddUniqueSql(string $name, string $tableName, array|string $
$this->assertSame($expected, $sql);
}

/** @dataProvider \Yiisoft\Db\Tests\Provider\CommandProvider::columnTypes */
public function testAlterColumn(ColumnInterface|string $type): void
public function testAlterColumn(): void
{
$db = $this->getConnection();

$command = $db->createCommand();
$sql = $command->alterColumn('table', 'column', $type)->getSql();

$type = $db->getQueryBuilder()->getColumnType($type);
$sql = $command->alterColumn('table', 'column', SchemaInterface::TYPE_INTEGER)->getSql();

$this->assertSame(
DbHelper::replaceQuotes(
<<<SQL
ALTER TABLE [[table]] CHANGE [[column]] [[column]] {$type}
ALTER TABLE [[table]] CHANGE [[column]] [[column]] integer
SQL,
$db->getDriverName(),
),
Expand Down

0 comments on commit 9dfab38

Please sign in to comment.