/**
  * @param $productScheduled
  * @param $expectedProductReindexCall
  *
  * @dataProvider reindexFlatDisabledTestDataProvider
  */
 public function testReindexFlatDisabled($productScheduled, $expectedProductReindexCall)
 {
     $affectedProductIds = ["1", "2"];
     $this->category->setAffectedProductIds($affectedProductIds);
     $pathIds = ['path/1/2', 'path/2/3'];
     $this->category->setData('path_ids', $pathIds);
     $this->category->setId('123');
     $this->flatState->expects($this->any())->method('isFlatEnabled')->will($this->returnValue(false));
     $this->productIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($productScheduled));
     $this->productIndexer->expects($this->exactly($expectedProductReindexCall))->method('reindexList')->with($pathIds);
     $this->indexerRegistry->expects($this->at(0))->method('get')->with(Indexer\Category\Product::INDEXER_ID)->will($this->returnValue($this->productIndexer));
     $this->category->reindex();
 }
 public function testGetUrl()
 {
     $this->assertStringEndsWith('catalog/category/view/', $this->_model->getUrl());
     $this->_model->setUrl('test_url');
     $this->assertEquals('test_url', $this->_model->getUrl());
     $this->_model->setUrl(null);
     $this->_model->setRequestPath('test_path');
     $this->assertStringEndsWith('test_path', $this->_model->getUrl());
     $this->_model->setUrl(null);
     $this->_model->setRequestPath(null);
     $this->_model->setId(1000);
     $this->assertStringEndsWith('catalog/category/view/id/1000/', $this->_model->getUrl());
 }
Example #3
0
 public function testMovePrimaryWorkflow()
 {
     $indexer = $this->getMock('stdClass', ['isScheduled']);
     $indexer->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
     $this->indexerRegistry->expects($this->once())->method('get')->with('catalog_category_product')->will($this->returnValue($indexer));
     $parentCategory = $this->getMock('Magento\\Catalog\\Model\\Category', ['getId', 'setStoreId', 'load'], [], '', false);
     $parentCategory->expects($this->any())->method('getId')->will($this->returnValue(5));
     $parentCategory->expects($this->any())->method('setStoreId')->will($this->returnSelf());
     $parentCategory->expects($this->any())->method('load')->will($this->returnSelf());
     $this->categoryRepository->expects($this->any())->method('get')->will($this->returnValue($parentCategory));
     $store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store));
     $this->category->setId(3);
     $this->category->move(5, 7);
 }
 /**
  * {@inheritdoc}
  */
 public function setId($value)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setId');
     if (!$pluginInfo) {
         return parent::setId($value);
     } else {
         return $this->___callPlugins('setId', func_get_args(), $pluginInfo);
     }
 }