Inheritance: extends Sonata\ProductBundle\Entity\BaseProductCategory
 public function testProductCategoriesSynchronization()
 {
     $provider = $this->getBaseProvider();
     $repository = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $em->expects($this->any())->method('getRepository')->will($this->returnValue($repository));
     $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em));
     $productCategoryManager = new ProductCategoryManager('Sonata\\Tests\\Component\\Product\\ProductCategory', $registry);
     $provider->setProductCategoryManager($productCategoryManager);
     // create product
     $product = new Product();
     // create category1 (main) and add to product
     $category1 = new Category();
     $category1->setId(1);
     $productCategory1 = new ProductCategory();
     $productCategory1->setId(1);
     $productCategory1->setMain(true);
     $productCategory1->setCategory($category1);
     $product->addProductCategory($productCategory1);
     // create product variation without sync categories
     $variation = $provider->createVariation($product, false);
     $this->assertEquals(0, count($variation->getProductCategories()));
     // synchronise 1 category
     $provider->synchronizeVariationsCategories($product);
     $this->assertEquals(1, count($variation->getProductCategories()));
     // create category2 and add to product
     $category2 = new Category();
     $category2->setId(2);
     $productCategory2 = new ProductCategory();
     $productCategory2->setId(2);
     $productCategory2->setCategory($category2);
     $product->addProductCategory($productCategory2);
     // variation still have 1 category (no sync yet)
     $this->assertEquals(1, count($variation->getProductCategories()));
     // synchronize 2 categories
     $provider->synchronizeVariationsCategories($product);
     $this->assertEquals(2, count($variation->getProductCategories()));
     // remove category1 from product
     $product->removeProductCategory($productCategory1);
     // variation still have 2 categories
     $this->assertEquals(2, count($variation->getProductCategories()));
     $provider->synchronizeVariationsCategories($product);
     //        $this->assertEquals(1, count($variation->getProductCategories()));
     //        $this->assertFalse($variation->getProductCategories()->contains($productCategory1));
     //        $this->assertTrue($variation->getProductCategories()->contains($productCategory2));
 }