Пример #1
0
 /**
  * @param bool $fixtureResultOne
  * @param bool $fixtureResultTwo
  * @param bool $expectedResult
  * @dataProvider cleanModeMatchingAnyTagDataProvider
  */
 public function testCleanModeMatchingAnyTag($fixtureResultOne, $fixtureResultTwo, $expectedResult)
 {
     $this->_frontend->expects($this->at(0))->method('clean')->with(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['test_tag_one', 'enforced_tag'])->will($this->returnValue($fixtureResultOne));
     $this->_frontend->expects($this->at(1))->method('clean')->with(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['test_tag_two', 'enforced_tag'])->will($this->returnValue($fixtureResultTwo));
     $actualResult = $this->_object->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, ['test_tag_one', 'test_tag_two']);
     $this->assertEquals($expectedResult, $actualResult);
 }
Пример #2
0
 /**
  * Retrieve cache frontend instance being decorated
  *
  * @return \Magento\Framework\Cache\FrontendInterface
  */
 protected function _getFrontend()
 {
     $frontend = parent::_getFrontend();
     if (!$frontend) {
         $frontend = $this->cacheFrontendPool->get(self::TYPE_IDENTIFIER);
         $this->setFrontend($frontend);
     }
     return $frontend;
 }
Пример #3
0
 /**
  * Returns a frontend on a first call to frontend interface methods
  * 
  * @SuppressWarnings(PHPMD.CamelCaseMethodName)
  *
  * @return FrontendInterface
  */
 protected function _getFrontend()
 {
     // @codingStandardsIgnoreEnd
     $frontend = parent::_getFrontend();
     if ($frontend === null) {
         $frontend = $this->frontendPool->get(self::CACHE_TYPE);
     }
     return $frontend;
 }
Пример #4
0
 /**
  * @param \Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool
  */
 public function __construct(\Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool)
 {
     parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG);
 }
Пример #5
0
 /**
  * @param FrontendPool $cacheFrontendPool
  */
 public function __construct(FrontendPool $cacheFrontendPool)
 {
     parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG);
 }
Пример #6
0
 /**
  * @param \Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool
  * @param StoreManagerInterface $storeManager
  * @param UserContextInterface $userContext
  */
 public function __construct(\Magento\Framework\App\Cache\Type\FrontendPool $cacheFrontendPool, StoreManagerInterface $storeManager, UserContextInterface $userContext)
 {
     $this->storeManager = $storeManager;
     $this->userContext = $userContext;
     parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG);
 }
Пример #7
0
 /**
  * {@inheritdoc}
  *
  * @param string $mode
  * @param array $tags
  * @return bool
  */
 public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, array $tags = [])
 {
     $this->eventManager->dispatch('adminhtml_cache_refresh_type');
     return parent::clean($mode, $tags);
 }