コード例 #1
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 testReindexByIds()
 {
     $this->prepareProducts();
     $this->indexerBuilder->reindexByIds([$this->product->getId(), $this->productSecond->getId(), $this->productThird->getId()]);
     $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()));
 }
コード例 #2
0
 /**
  * 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]);
 }
コード例 #3
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]);
 }