@@ -85,4 +85,47 @@ public function testUpdate(): void
85
85
$ this ->assertTrue ($ this ->schema ->hasColumn ($ table , 'country ' ));
86
86
$ this ->assertTrue ($ this ->schema ->hasColumn ($ table , 'finish ' ));
87
87
}
88
+
89
+ /**
90
+ * @return void
91
+ * @covers WordPressBuilder::drop
92
+ */
93
+ public function testDrop (): void
94
+ {
95
+ $ this ->schema ->create ('company ' , function (Blueprint $ table ) {
96
+ $ table ->id ();
97
+ $ table ->string ('name ' );
98
+ $ table ->string ('slug ' );
99
+ });
100
+
101
+ $ this ->assertTrue ($ this ->schema ->hasTable ('company ' ));
102
+ $ this ->schema ->drop ('company ' );
103
+ $ this ->assertFalse ($ this ->schema ->hasTable ('company ' ));
104
+ }
105
+
106
+ /**
107
+ * @return void
108
+ * @covers WordPressBuilder::dropColumns
109
+ */
110
+ public function testDropColumn (): void
111
+ {
112
+ $ this ->schema ->create ('address ' , function (Blueprint $ table ) {
113
+ $ table ->id ();
114
+ $ table ->string ('firstname ' );
115
+ $ table ->string ('lastname ' );
116
+ $ table ->string ('street_1 ' );
117
+ $ table ->string ('street_2 ' );
118
+ $ table ->string ('street_3 ' );
119
+ });
120
+
121
+ $ table = $ this ->database ->getTablePrefix () . 'address ' ;
122
+ $ columns = $ this ->schema ->getColumns ($ table );
123
+ $ this ->assertCount (5 , $ columns );
124
+
125
+ $ this ->schema ->dropColumns ('address ' , ['street_3 ' ]);
126
+ $ columns = $ this ->schema ->getColumns ($ table );
127
+ $ this ->assertCount (4 , $ columns );
128
+ $ this ->assertFalse ($ this ->schema ->hasColumn ($ table , 'street_3 ' ));
129
+
130
+ }
88
131
}
0 commit comments