diff --git a/tests/Db/Command/CommandTest.php b/tests/Db/Command/CommandTest.php index 463ffcc81..689d81caf 100644 --- a/tests/Db/Command/CommandTest.php +++ b/tests/Db/Command/CommandTest.php @@ -10,6 +10,7 @@ use Yiisoft\Db\Exception\NotSupportedException; use Yiisoft\Db\Schema\Builder\ColumnInterface; use Yiisoft\Db\Tests\AbstractCommandTest; +use Yiisoft\Db\Tests\Provider\CommandProvider; use Yiisoft\Db\Tests\Support\Assert; use Yiisoft\Db\Tests\Support\DbHelper; use Yiisoft\Db\Tests\Support\TestTrait; @@ -460,20 +461,7 @@ public function testDropView(): void ); } - public static function dataDropTable(): iterable - { - yield ['DROP TABLE [[table]]', null, null]; - yield ['DROP TABLE IF EXISTS [[table]]', true, null]; - yield ['DROP TABLE [[table]]', false, null]; - yield ['DROP TABLE [[table]] CASCADE', null, true]; - yield ['DROP TABLE [[table]]', null, false]; - yield ['DROP TABLE [[table]]', false, false]; - yield ['DROP TABLE IF EXISTS [[table]] CASCADE', true, true]; - yield ['DROP TABLE IF EXISTS [[table]]', true, false]; - yield ['DROP TABLE [[table]] CASCADE', false, true]; - } - - #[DataProvider('dataDropTable')] + #[DataProvider(CommandProvider::class.'::dropTable')] public function testDropTable(string $expected, ?bool $ifExists, ?bool $cascade): void { $db = $this->getConnection(); diff --git a/tests/Provider/CommandProvider.php b/tests/Provider/CommandProvider.php index 6c6dfc84a..e2afcdd41 100644 --- a/tests/Provider/CommandProvider.php +++ b/tests/Provider/CommandProvider.php @@ -926,4 +926,17 @@ public static function columnTypes(): array [new Column('string(100)')], ]; } + + public static function dropTable(): iterable + { + yield ['DROP TABLE [[table]]', null, null]; + yield ['DROP TABLE IF EXISTS [[table]]', true, null]; + yield ['DROP TABLE [[table]]', false, null]; + yield ['DROP TABLE [[table]] CASCADE', null, true]; + yield ['DROP TABLE [[table]]', null, false]; + yield ['DROP TABLE [[table]]', false, false]; + yield ['DROP TABLE IF EXISTS [[table]] CASCADE', true, true]; + yield ['DROP TABLE IF EXISTS [[table]]', true, false]; + yield ['DROP TABLE [[table]] CASCADE', false, true]; + } }