public function testAddCatalogToTopMenuItemsWithFlat()
 {
     $observer = $this->_preparationData();
     $this->_category->expects($this->once())->method('getChildrenNodes')->will($this->returnValue([$this->_childrenCategory]));
     $this->_category->expects($this->once())->method('getUseFlatResource')->will($this->returnValue(true));
     $this->_categoryFlatState->expects($this->once())->method('isFlatEnabled')->will($this->returnValue(true));
     $this->_observer->execute($observer);
 }
示例#2
0
 public function testAroundSaveNotNew()
 {
     $this->stateMock->expects($this->never())->method('isFlatEnabled');
     $this->groupMock = $this->getMock('Magento\\Store\\Model\\Group', array('dataHasChangedFor', 'isObjectNew', '__wakeup'), array(), '', false);
     $this->groupMock->expects($this->once())->method('dataHasChangedFor')->with('root_category_id')->will($this->returnValue(true));
     $this->groupMock->expects($this->once())->method('isObjectNew')->will($this->returnValue(true));
     $this->assertFalse($this->model->aroundSave($this->subjectMock, $this->closureMock, $this->groupMock));
 }
 /**
  * @param bool $isFlat
  * @param string $path
  * @param mixed $default
  * @param array $inputData
  * @param array $outputData
  * @dataProvider aroundGetDataProvider
  */
 public function testAroundGet($isFlat, $path, $default, $inputData, $outputData)
 {
     $this->stateMock->expects($this->once())->method('isFlatEnabled')->will($this->returnValue($isFlat));
     $closureMock = function () use($inputData) {
         return $inputData;
     };
     $this->assertEquals($outputData, $this->model->aroundGet($this->subjectMock, $closureMock, $path, $default));
 }
示例#4
0
 /**
  * @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();
 }
示例#5
0
 public function testGetUseFlatResourceTrue()
 {
     $this->flatState->expects($this->any())->method('isAvailable')->will($this->returnValue(true));
     $category = $this->getCategoryModel();
     $this->assertEquals(true, $category->getUseFlatResource());
 }
 protected function mockConfigFlatEnabledNeever()
 {
     $this->stateMock->expects($this->never())->method('isFlatEnabled');
 }