/** * @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); }
/** * 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; }