File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,9 @@ public function addColumn(
149149 * @param string $tableName
150150 * @param string $columnName
151151 * @return bool
152+ * @checked
153+ * @noTodo
154+ * @unitTest
152155 */
153156 public function removeColumn (string $ tableName , string $ columnName )
154157 {
Original file line number Diff line number Diff line change @@ -139,7 +139,29 @@ public function test_addColumn()
139139 */
140140 public function test_removeColumn ()
141141 {
142- $ this ->markTestIncomplete ('このテストは、まだ実装されていません。 ' );
142+ // テーブル生成
143+ $ table = 'table_test_remove ' ;
144+ $ columns = [
145+ 'id ' => ['type ' => 'integer ' ],
146+ 'remove_column ' => ['type ' => 'text ' ],
147+ ];
148+ $ schema = new BcSchema ($ table , $ columns );
149+ $ schema ->create ();
150+
151+ // 対象メソッドを呼ぶ
152+ $ result = $ this ->BcDatabaseService ->removeColumn ($ table , 'remove_column ' );
153+ $ tableTest = TableRegistry::getTableLocator ()
154+ ->get ('BaserCore.App ' )
155+ ->getConnection ()
156+ ->getSchemaCollection ()
157+ ->describe ($ table );
158+ // 戻り値を確認
159+ $ this ->assertTrue ($ result );
160+ // カラムが削除されているか確認
161+ $ this ->assertFalse ($ tableTest ->hasColumn ('remove_column ' ));
162+
163+ // テストテーブルを削除
164+ $ this ->BcDatabaseService ->dropTable ($ table );
143165 }
144166
145167 /**
You can’t perform that action at this time.
0 commit comments