Пример #1
0
 /**
  * @magentoDataFixture Magento/Backend/controllers/_files/cache/application_cache.php
  * @magentoDataFixture Magento/Widget/_files/layout_cache.php
  */
 public function testSaveAfterClearCache()
 {
     /** @var $appCache \Magento\Framework\App\Cache */
     $appCache = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\Cache');
     /** @var \Magento\Framework\App\Cache\Type\Layout $layoutCache */
     $layoutCache = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\Cache\\Type\\Layout');
     $this->assertNotEmpty($appCache->load('APPLICATION_FIXTURE'));
     $this->assertNotEmpty($layoutCache->load('LAYOUT_CACHE_FIXTURE'));
     /** @var $layoutUpdate \Magento\Widget\Model\Layout\Update */
     $layoutUpdate = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Widget\\Model\\Layout\\Update');
     $layoutUpdate->setHasDataChanges(true);
     $this->_resourceModel->save($layoutUpdate);
     $this->assertNotEmpty($appCache->load('APPLICATION_FIXTURE'), 'Non-layout cache must be kept');
     $this->assertFalse($layoutCache->load('LAYOUT_CACHE_FIXTURE'), 'Layout cache must be erased');
 }
Пример #2
0
 /**
  * Around getDbUpdateString
  *
  * @param \Magento\Framework\View\Model\Layout\Merge $subject
  * @param callable $proceed
  * @param string $handle
  * @return string
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundGetDbUpdateString(\Magento\Framework\View\Model\Layout\Merge $subject, \Closure $proceed, $handle)
 {
     return $this->update->fetchUpdatesByHandle($handle, $subject->getTheme(), $subject->getScope());
 }