コード例 #1
0
 /**
  * @param string $area
  * @param string $themePath
  * @param string $locale
  * @param string $module
  * @param string $expectedId
  * @param string $savedValue
  *
  * @dataProvider cacheDataProvider
  */
 public function testSaveToCache($area, $themePath, $locale, $module, $expectedId, $savedValue)
 {
     if (isset($params['theme'])) {
         $this->theme->expects($this->any())->method('getThemePath')->will($this->returnValue($params['theme']));
         $params['theme'] = $this->theme;
     } else {
         $this->theme->expects($this->never())->method('getThemePath');
     }
     $this->cache->expects($this->once())->method('save')->with($savedValue, $expectedId)->will($this->returnValue(true));
     $actual = $this->object->saveToCache($savedValue, 'file', 'file.ext', $area, $themePath, $locale, $module);
     $this->assertTrue($actual);
 }
コード例 #2
0
 /**
  * Save cache
  */
 public function __destruct()
 {
     foreach ($this->isDirty as $sectionId) {
         $value = json_encode($this->cacheSections[$sectionId]);
         $this->cache->save($value, $sectionId);
     }
 }
コード例 #3
0
 /**
  * Ensure that same data is not saved again
  */
 public function testSaveToCacheNotDirty()
 {
     $this->cache->expects($this->never())->method('save');
     $this->cache->expects($this->once())->method('load')->with('type:file|area:frontend|theme:magento_theme|locale:en_US')->will($this->returnValue(json_encode(['module:Magento_Module|file:file.ext' => 'some/file.ext'])));
     $this->object->saveToCache('some/file.ext', 'file', 'file.ext', 'frontend', 'magento_theme', 'en_US', 'Magento_Module');
     $this->object = null;
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function saveToCache($value, $type, $file, $area, $themePath, $locale, $module)
 {
     $cacheId = $this->getCacheId($type, $file, $area, $themePath, $locale, $module);
     return $this->cache->save($value, $cacheId);
 }