コード例 #1
0
 public function testCleanType()
 {
     $this->_cache->expects($this->once())->method('load')->with(TypeList::INVALIDATED_TYPES)->will($this->returnValue(serialize($this->_typesArray)));
     $this->_config->expects($this->once())->method('getType')->with(self::TYPE_KEY)->will($this->returnValue(['instance' => self::CACHE_TYPE]));
     unset($this->_typesArray[self::TYPE_KEY]);
     $this->_cache->expects($this->once())->method('save')->with(serialize($this->_typesArray), TypeList::INVALIDATED_TYPES);
     $this->_typeList->cleanType(self::TYPE_KEY);
 }
コード例 #2
0
ファイル: TypeList.php プロジェクト: shabbirvividads/magento2
 /**
  * {@inheritdoc}
  */
 public function getTypeLabels()
 {
     $types = [];
     foreach ($this->_config->getTypes() as $type => $node) {
         if (array_key_exists('label', $node)) {
             $types[$type] = $node['label'];
         }
     }
     return $types;
 }
コード例 #3
0
 /**
  * Get information about all declared cache types
  *
  * @return array
  */
 public function getTypes()
 {
     $types = array();
     $config = $this->_config->getTypes();
     foreach ($config as $type => $node) {
         $typeInstance = $this->_getTypeInstance($type);
         if ($typeInstance instanceof \Magento\Framework\Cache\Frontend\Decorator\TagScope) {
             $typeTags = $typeInstance->getTag();
         } else {
             $typeTags = '';
         }
         $types[$type] = new \Magento\Framework\Object(array('id' => $type, 'cache_type' => $node['label'], 'description' => $node['description'], 'tags' => $typeTags, 'status' => (int) $this->_cacheState->isEnabled($type)));
     }
     return $types;
 }