/**
  * test beforeExecute
  */
 public function testBeforeExecute()
 {
     $expectedIds = [1, 2, 3];
     $this->contextMock->expects($this->once())->method('registerEntities')->with($this->equalTo(\Magento\Catalog\Model\Product::ENTITY), $this->equalTo($expectedIds))->will($this->returnValue($this->contextMock));
     $actualIds = $this->plugin->beforeExecute($this->subjectMock, $expectedIds);
     $this->assertEquals([$expectedIds], $actualIds);
 }
 public function testDoExecuteList()
 {
     $ids = [1, 2, 5];
     $this->indexBuilder->expects($this->once())->method('reindexFull');
     $this->cacheContextMock->expects($this->once())->method('registerTags')->with([\Magento\Catalog\Model\Category::CACHE_TAG, \Magento\Catalog\Model\Product::CACHE_TAG, \Magento\Framework\App\Cache\Type\Block::CACHE_TAG]);
     $this->indexer->executeList($ids);
 }
 /**
  * Test afterUpdateMview
  *
  * @return void
  */
 public function testAfterUpdateMview()
 {
     $tags = ['tag_name1', 'tag_name2'];
     $this->eventManagerMock->expects($this->once())->method('dispatch')->with($this->equalTo('clean_cache_after_reindex'), $this->equalTo(['object' => $this->contextMock]));
     $this->contextMock->expects($this->atLeastOnce())->method('getIdentities')->willReturn($tags);
     $this->cacheMock->expects($this->once())->method('clean')->with($tags);
     $this->plugin->afterUpdateMview($this->subjectMock);
 }
Beispiel #4
0
 public function testExecuteFull()
 {
     /** @var \Magento\Catalog\Model\Indexer\Category\Product\Action\Full $productIndexerFlatFull */
     $productIndexerFlatFull = $this->getMock(\Magento\Catalog\Model\Indexer\Category\Product\Action\Full::class, [], [], '', false);
     $this->fullMock->expects($this->once())->method('create')->willReturn($productIndexerFlatFull);
     $productIndexerFlatFull->expects($this->once())->method('execute');
     $this->cacheContextMock->expects($this->once())->method('registerTags')->with([\Magento\Catalog\Model\Category::CACHE_TAG]);
     $this->model->executeFull();
 }
Beispiel #5
0
 public function testExecuteFull()
 {
     $this->productFlatIndexerFull->expects($this->any())->method('execute');
     $this->cacheContextMock->expects($this->once())->method('registerTags')->with([\Magento\Catalog\Model\Category::CACHE_TAG, \Magento\Catalog\Model\Product::CACHE_TAG]);
     $this->model->executeFull();
 }
 /**
  * @param array $ids
  * @param array $idsForIndexer
  * @dataProvider dataProviderForExecuteList
  */
 public function testDoExecuteList($ids, $idsForIndexer)
 {
     $this->indexBuilder->expects($this->once())->method('reindexByIds')->with($idsForIndexer);
     $this->cacheContextMock->expects($this->once())->method('registerEntities')->with(\Magento\Catalog\Model\Product::CACHE_TAG, $ids);
     $this->indexer->executeList($ids);
 }