/**
  * @covers \Magento\LayeredNavigation\Block\Navigation::getLayer()
  * @covers \Magento\LayeredNavigation\Block\Navigation::getFilters()
  * @covers \Magento\LayeredNavigation\Block\Navigation::canShowBlock()
  */
 public function testCanShowBlock()
 {
     // getFilers()
     $filters = ['To' => 'be', 'or' => 'not', 'to' => 'be'];
     $this->filterListMock->expects($this->exactly(2))->method('getFilters')->with($this->catalogLayerMock)->will($this->returnValue($filters));
     $this->assertEquals($filters, $this->model->getFilters());
     // canShowBlock()
     $enabled = true;
     $this->visibilityFlagMock->expects($this->once())->method('isEnabled')->with($this->catalogLayerMock, $filters)->will($this->returnValue($enabled));
     $this->assertEquals($enabled, $this->model->canShowBlock());
 }
Beispiel #2
0
 /**
  * Check if we can show this block.
  * According to @see \Magento\LayeredNavigationStaging\Block\Navigation::canShowBlock
  * We should not show the block if staging is enabled and if we are currently previewing the results.
  *
  * @return bool
  */
 public function canShowBlock()
 {
     if ($this->moduleManager->isEnabled('Magento_Staging')) {
         try {
             $versionManager = $this->objectManager->get('\\Magento\\Staging\\Model\\VersionManager');
             return parent::canShowBlock() && !$versionManager->isPreviewVersion();
         } catch (\Exception $exception) {
             return parent::canShowBlock();
         }
     }
     return parent::canShowBlock();
 }