コード例 #1
0
 public function testIndexerAfterDeleteAttribute()
 {
     $this->_processor->expects($this->once())->method('markIndexerAsInvalid');
     $this->_model->setOrigData('id', 2);
     $this->_model->setOrigData('used_in_product_listing', 1);
     $this->_model->afterDeleteCommit();
 }
コード例 #2
0
 /**
  * @param string $matcherMethod
  * @param bool $websiteChanged
  * @dataProvider storeGroupWebsiteDataProvider
  */
 public function testChangedWebsiteBeforeSave($matcherMethod, $websiteChanged)
 {
     $this->processorMock->expects($this->{$matcherMethod}())->method('markIndexerAsInvalid');
     $this->storeGroupMock->expects($this->once())->method('getId')->will($this->returnValue(1));
     $this->storeGroupMock->expects($this->once())->method('dataHasChangedFor')->with('root_category_id')->will($this->returnValue($websiteChanged));
     $model = new \Magento\Catalog\Model\Indexer\Product\Flat\Plugin\StoreGroup($this->processorMock);
     $model->beforeSave($this->subjectMock, $this->storeGroupMock);
 }
コード例 #3
0
 public function testReindex()
 {
     $this->categoryIndexerMock->expects($this->once())->method('reindexRow');
     $this->productFlatProcessor->expects($this->once())->method('reindexRow');
     $this->prepareCategoryIndexer();
     $this->assertNull($this->model->reindex());
 }
コード例 #4
0
 /**
  * @param $productChanged
  * @param $isScheduled
  * @param $productFlatCount
  * @param $categoryIndexerCount
  *
  * @dataProvider getProductReindexProvider
  */
 public function testReindex($productChanged, $isScheduled, $productFlatCount, $categoryIndexerCount)
 {
     $this->model->setData('entity_id', 1);
     $this->_catalogProduct->expects($this->once())->method('isDataForProductCategoryIndexerWasChanged')->willReturn($productChanged);
     if ($productChanged) {
         $this->indexerRegistryMock->expects($this->exactly($productFlatCount))->method('get')->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)->will($this->returnValue($this->categoryIndexerMock));
         $this->categoryIndexerMock->expects($this->any())->method('isScheduled')->will($this->returnValue($isScheduled));
         $this->categoryIndexerMock->expects($this->exactly($categoryIndexerCount))->method('reindexRow');
     }
     $this->productFlatProcessor->expects($this->exactly($productFlatCount))->method('reindexRow');
     $this->model->reindex();
 }
コード例 #5
0
 /**
  * @param string $oldValue
  * @param string $value
  * @dataProvider dataProviderProcessValueOff
  */
 public function testProcessValueOff($oldValue, $value)
 {
     $this->configMock->expects($this->once())->method('getValue')->with(null, 'default')->will($this->returnValue($oldValue));
     $this->model->setValue($value);
     $this->indexerStateMock->expects($this->never())->method('loadByIndexer');
     $this->indexerStateMock->expects($this->never())->method('setStatus');
     $this->indexerStateMock->expects($this->never())->method('save');
     $indexerMock = $this->getMockForAbstractClass('Magento\\Indexer\\Model\\IndexerInterface', array(), '', false, false, true, array('setScheduled', '__wakeup'));
     $indexerMock->expects($this->once())->method('setScheduled')->with(false);
     $this->indexerProcessorMock->expects($this->once())->method('getIndexer')->will($this->returnValue($indexerMock));
     $this->model->processValue();
 }