31 private $objectManager;
36 private $productRepository;
41 private $storeRepository;
49 $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
50 $this->storeRepository = $this->objectManager->get(StoreRepositoryInterface::class);
59 $instance = $this->getWebsiteAttributesSynchronizer();
60 $this->assertFalse($instance->isSynchronizationRequired());
61 $instance->scheduleSynchronization();
62 $this->assertTrue($instance->isSynchronizationRequired());
71 $firstStore = $this->storeRepository->get(self::FIRST_STORE_CODE);
72 $secondStore = $this->storeRepository->get(self::SECOND_STORE_CODE);
74 $firstStoreProduct = $this->productRepository->getById(
76 self::PRODUCT_NOT_EDIT_MODE,
80 $secondStoreProduct = $this->productRepository->getById(
82 self::PRODUCT_NOT_EDIT_MODE,
86 $instance = $this->getWebsiteAttributesSynchronizer();
88 $this->assertNotEquals($firstStoreProduct->getStatus(), $secondStoreProduct->getStatus());
89 $this->assertEquals(AttributeStatus::STATUS_DISABLED, $firstStoreProduct->getStatus());
90 $this->assertEquals(AttributeStatus::STATUS_ENABLED, $secondStoreProduct->getStatus());
91 $this->assertTrue($instance->isSynchronizationRequired());
93 $instance->synchronize();
95 $firstStoreProductAfterSync = $this->productRepository->getById(
97 self::PRODUCT_NOT_EDIT_MODE,
102 $secondStoreProductAfterSync = $this->productRepository->getById(
104 self::PRODUCT_NOT_EDIT_MODE,
109 $this->assertEquals($firstStoreProductAfterSync->getStatus(), $secondStoreProductAfterSync->getStatus());
110 $this->assertFalse($instance->isSynchronizationRequired());
116 private function getWebsiteAttributesSynchronizer()
118 return $this->objectManager->get(WebsiteAttributesSynchronizer::class);
const PRODUCT_NOT_EDIT_MODE
const PRODUCT_FORCE_RELOAD
testScheduleSynchronization()
static getObjectManager()