示例#1
0
 /**
  * Execute full indexation
  *
  * @return void
  */
 public function executeFull()
 {
     $this->indexBuilder->reindexFull();
     $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]);
     //TODO: remove after fix fpc. MAGETWO-50668
     $this->getCacheManager()->clean($this->getIdentities());
 }
示例#2
0
 /**
  * @magentoDbIsolation enabled
  * @magentoAppIsolation enabled
  * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
  * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
  * @magentoDataFixture Magento/Catalog/_files/product_simple.php
  */
 public function testReindexFull()
 {
     $this->prepareProducts();
     $this->indexerBuilder->reindexFull();
     $this->assertEquals(9.800000000000001, $this->resourceRule->getRulePrice(new \DateTime(), 1, 1, $this->product->getId()));
     $this->assertEquals(9.800000000000001, $this->resourceRule->getRulePrice(new \DateTime(), 1, 1, $this->productSecond->getId()));
     $this->assertFalse($this->resourceRule->getRulePrice(new \DateTime(), 1, 1, $this->productThird->getId()));
 }
 /**
  * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
  * @magentoDataFixture Magento/Catalog/_files/product_simple.php
  */
 public function testReindexAfterRuleCreation()
 {
     $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
     $this->assertFalse($this->resourceRule->getRulePrice(new \DateTime(), 1, 1, 1));
     $this->saveRule();
     // apply all rules
     $this->indexBuilder->reindexFull();
     $this->assertEquals(9.800000000000001, $this->resourceRule->getRulePrice(new \DateTime(), 1, 1, 1));
 }
示例#4
0
 /**
  * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
  * @magentoDataFixture Magento/Catalog/_files/product_simple.php
  */
 public function testReindexAfterRuleCreation()
 {
     /** @var \Magento\Catalog\Model\ProductRepository $productRepository */
     $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\ProductRepository');
     $product = $productRepository->get('simple');
     $product->setData('test_attribute', 'test_attribute_value')->save();
     $this->assertFalse($this->resourceRule->getRulePrice(new \DateTime(), 1, 1, $product->getId()));
     $this->saveRule();
     // apply all rules
     $this->indexBuilder->reindexFull();
     $this->assertEquals(9.800000000000001, $this->resourceRule->getRulePrice(new \DateTime(), 1, 1, $product->getId()));
 }
 /**
  * Test UpdateCatalogRuleGroupWebsiteData
  *
  * @covers \Magento\CatalogRule\Model\Indexer\IndexBuilder::updateCatalogRuleGroupWebsiteData
  * @return void
  */
 public function testUpdateCatalogRuleGroupWebsiteData()
 {
     $priceAttrMock = $this->getMock('Magento\\Catalog\\Model\\Entity\\Attribute', ['getBackend'], [], '', false);
     $backendModelMock = $this->getMock('Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Tierprice', ['getResource'], [], '', false);
     $resourceMock = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Backend\\Tierprice', ['getMainTable'], [], '', false);
     $resourceMock->expects($this->any())->method('getMainTable')->will($this->returnValue('catalog_product_entity_tear_price'));
     $backendModelMock->expects($this->any())->method('getResource')->will($this->returnValue($resourceMock));
     $priceAttrMock->expects($this->any())->method('getBackend')->will($this->returnValue($backendModelMock));
     $this->eavConfig->expects($this->at(0))->method('getAttribute')->with(\Magento\Catalog\Model\Product::ENTITY, 'price')->will($this->returnValue($this->attribute));
     $this->select->expects($this->once())->method('insertFromSelect')->with('catalogrule_group_website');
     $this->indexBuilder->reindexByIds([1]);
 }
示例#6
0
 public function testDoExecuteRow()
 {
     $id = 5;
     $this->indexBuilder->expects($this->once())->method('reindexById')->with($id);
     $this->indexer->executeRow($id);
 }
 /**
  * Execute full indexation
  *
  * @return void
  */
 public function executeFull()
 {
     $this->indexBuilder->reindexFull();
     $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]);
 }
示例#8
0
 /**
  * Test execute full reindex action
  *
  * @return void
  */
 public function testExecuteFull()
 {
     $this->indexBuilder->expects($this->once())->method('reindexFull');
     $this->_eventManagerMock->expects($this->once())->method('dispatch')->with('clean_cache_by_tags', ['object' => $this->indexer]);
     $this->indexer->executeFull();
 }
示例#9
0
 public function testDoExecuteRow()
 {
     $this->indexBuilder->expects($this->once())->method('reindexFull');
     $this->indexer->executeRow(5);
 }
示例#10
0
 /**
  * Test UpdateCatalogRuleGroupWebsiteData
  *
  * @covers \Magento\CatalogRule\Model\Indexer\IndexBuilder::updateCatalogRuleGroupWebsiteData
  * @return void
  */
 public function testUpdateCatalogRuleGroupWebsiteData()
 {
     $this->select->expects($this->once())->method('insertFromSelect')->with('catalogrule_group_website');
     $this->indexBuilder->reindexByIds([1]);
 }