Example #1
0
 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));
     }
 }