public function testSync() { $product = new Product(); $this->assertEquals(6, count($product->getFieldsInit())); $models = [new ProductList(), new Category(), new User(), $product]; $sync = new Sync($models); $sync->delete(); foreach ($models as $model) { $this->assertFalse($sync->hasTable($model)); } // Create all tables. If table exists - skip. $sync->create(); foreach ($models as $model) { $this->assertTrue($sync->hasTable($model)); } // Remove all tables. If table does not exists - skip. $sync->delete(); foreach ($models as $model) { $this->assertFalse($sync->hasTable($model)); } }
public function actionDrop($module = null) { $models = $this->getModels($module); $sync = new Sync(array_values($models)); $sync->delete(); }
public function dropModels(array $models) { $sync = new Sync($models); $sync->delete(); }