Skip to content

Commit c859fea

Browse files
committed
Add stub and failing tests for cebe#132
1 parent 0038084 commit c859fea

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
return [
4+
'openApiPath' => '@specs/issue_fix/create_table_in_down_code/create_table_in_down_code.yaml',
5+
'generateUrls' => false,
6+
'generateModels' => false,
7+
'excludeModels' => [
8+
'Error',
9+
],
10+
'generateControllers' => false,
11+
'generateMigrations' => true,
12+
'generateModelFaker' => false,
13+
];
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
openapi: "3.0.0"
2+
info:
3+
version: 1.0.0
4+
title: Create table in down code
5+
paths:
6+
/:
7+
get:
8+
summary: List
9+
operationId: list
10+
responses:
11+
'200':
12+
description: The information
13+
14+
components:
15+
schemas:
16+
Fruit:
17+
type: object
18+
description: Create table in down code
19+
properties:
20+
id:
21+
type: integer
22+
colourName:
23+
type: string
24+
maxLength: 255

tests/unit/IssueFixTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,39 @@ private function createTableForQuoteInAlterColumn()
127127
'colourName' => 'varchar(255)',
128128
])->execute();
129129
}
130+
131+
// Stub -> https://github.com/cebe/yii2-openapi/issues/132
132+
// public function testCreateTableInDownCode()
133+
// {
134+
// $testFile = Yii::getAlias("@specs/issue_fix/create_table_in_down_code/create_table_in_down_code.php");
135+
// $this->deleteTablesForCreateTableInDownCode();
136+
// $this->createTableForCreateTableInDownCode();
137+
// $this->runGenerator($testFile, 'mysql');
138+
// // $actualFiles = FileHelper::findFiles(Yii::getAlias('@app'), [
139+
// // 'recursive' => true,
140+
// // ]);
141+
// // $expectedFiles = FileHelper::findFiles(Yii::getAlias("@specs/issue_fix/create_table_in_down_code/mysql/app"), [
142+
// // 'recursive' => true,
143+
// // ]);
144+
// // $this->checkFiles($actualFiles, $expectedFiles);
145+
// // $this->runActualMigrations('mysql', 1);
146+
// }
147+
148+
// private function deleteTablesForCreateTableInDownCode()
149+
// {
150+
// Yii::$app->db->createCommand('DROP TABLE IF EXISTS {{%fruits}}')->execute();
151+
// Yii::$app->db->createCommand('DROP TABLE IF EXISTS {{%animals}}')->execute();
152+
// }
153+
154+
// private function createTableForCreateTableInDownCode()
155+
// {
156+
// Yii::$app->db->createCommand()->createTable('{{%fruits}}', [
157+
// 'id' => 'pk',
158+
// 'colourName' => 'varchar(255)',
159+
// ])->execute();
160+
// Yii::$app->db->createCommand()->createTable('{{%animals}}', [
161+
// 'id' => 'pk',
162+
// 'colourName' => 'varchar(255)',
163+
// ])->execute();
164+
// }
130165
}

0 commit comments

Comments
 (0)