Skip to content

Commit d45f911

Browse files
committed
Test cleanup
1 parent 6644d15 commit d45f911

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

tests/unit/IssueFixTest.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -277,31 +277,33 @@ public function testNullableFalseInRequired()
277277

278278
// Create migration for drop table if a entire schema is deleted from OpenAPI spec #132
279279
// https://github.com/cebe/yii2-openapi/issues/132
280-
public function testCreateMigrationForDropTable132()
281-
{
282-
// $this->changeDbToMariadb();
283-
$testFile = Yii::getAlias("@specs/issue_fix/132_create_migration_for_drop_table/132_create_migration_for_drop_table.php");
284-
// $this->deleteTablesForCreateMigrationForDropTable132();
285-
$this->createTablesForCreateMigrationForDropTable132();
286-
// sleep(3000);
287-
$this->runGenerator($testFile);
288-
// $this->runActualMigrations('mysql', 3);
289-
// ... TODO
290-
$this->deleteTablesForCreateMigrationForDropTable132();
291-
// $this->deleteTables();
292-
}
280+
public function testCreateMigrationForDropTable132()
281+
{
282+
$testFile = Yii::getAlias("@specs/issue_fix/132_create_migration_for_drop_table/132_create_migration_for_drop_table.php");
283+
// $this->deleteTablesForCreateMigrationForDropTable132();
284+
$this->createTablesForCreateMigrationForDropTable132();
285+
$this->runGenerator($testFile);
286+
$this->runActualMigrations('mysql', 3);
287+
// ... TODO compare files
288+
$this->deleteTablesForCreateMigrationForDropTable132();
289+
// $this->deleteTables();
290+
}
293291

294292
private function createTablesForCreateMigrationForDropTable132()
295293
{
294+
// Yii::$app->db->createCommand()->createTable('{{%upks}}', [
295+
// 'id' => 'upk',
296+
// 'name' => 'string(150)',
297+
// ])->execute();
298+
296299
Yii::$app->db->createCommand()->createTable('{{%fruits}}', [
297-
'id' => 'ubigpk',
300+
'id' => 'pk',
298301
'name' => 'string(150)',
299302
])->execute();
300303
Yii::$app->db->createCommand()->createTable('{{%pristines}}', [
301304
'id' => 'pk',
302305
'name' => 'string(151)',
303-
'fruit_id' => 'bigint unsigned', // FK
304-
// 'fruit_id' => $this->integer()->unsigned(), // FK
306+
'fruit_id' => 'int', // FK
305307
])->execute();
306308
Yii::$app->db->createCommand()->addForeignKey('name', '{{%pristines}}', 'fruit_id', '{{%fruits}}', 'id')->execute();
307309
}
@@ -311,6 +313,7 @@ private function deleteTablesForCreateMigrationForDropTable132()
311313
Yii::$app->db->createCommand()->dropForeignKey('name', '{{%pristines}}')->execute();
312314
Yii::$app->db->createCommand('DROP TABLE IF EXISTS {{%pristines}}')->execute();
313315
Yii::$app->db->createCommand('DROP TABLE IF EXISTS {{%fruits}}')->execute();
316+
Yii::$app->db->createCommand('DROP TABLE IF EXISTS {{%upks}}')->execute();
314317
}
315318

316319
public function test162BugDollarrefWithXFaker()

0 commit comments

Comments
 (0)