Ejemplo n.º 1
0
 public function testGetUpdate()
 {
     $themeMock = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface');
     $this->themeResolverMock->expects($this->once())->method('get')->will($this->returnValue($themeMock));
     $this->processorFactoryMock->expects($this->once())->method('create')->with(['theme' => $themeMock])->will($this->returnValue($this->processorMock));
     $this->assertEquals($this->processorMock, $this->model->getUpdate());
     $this->assertEquals($this->processorMock, $this->model->getUpdate());
 }
 /**
  * Replace the output of the block, containing ttl attribute, with ESI tag
  *
  * @param \Magento\Framework\View\Element\AbstractBlock $block
  * @param \Magento\Framework\View\Layout $layout
  * @return string
  */
 protected function _wrapEsi(\Magento\Framework\View\Element\AbstractBlock $block, \Magento\Framework\View\Layout $layout)
 {
     $url = $block->getUrl('page_cache/block/esi', ['blocks' => json_encode([$block->getNameInLayout()]), 'handles' => json_encode($layout->getUpdate()->getHandles())]);
     // Varnish does not support ESI over HTTPS must change to HTTP
     $url = substr($url, 0, 5) === 'https' ? 'http' . substr($url, 5) : $url;
     return sprintf('<esi:include src="%s" />', $url);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getUpdate()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getUpdate');
     if (!$pluginInfo) {
         return parent::getUpdate();
     } else {
         return $this->___callPlugins('getUpdate', func_get_args(), $pluginInfo);
     }
 }
 /**
  * Replace the output of the block, containing ttl attribute, with ESI tag
  *
  * @param \Magento\Framework\View\Element\AbstractBlock $block
  * @param \Magento\Framework\View\Layout $layout
  * @return string
  */
 protected function _wrapEsi(\Magento\Framework\View\Element\AbstractBlock $block, \Magento\Framework\View\Layout $layout)
 {
     $url = $block->getUrl('page_cache/block/esi', ['blocks' => json_encode([$block->getNameInLayout()]), 'handles' => json_encode($layout->getUpdate()->getHandles())]);
     return sprintf('<esi:include src="%s" />', $url);
 }
Ejemplo n.º 5
0
 public function testGetUpdate()
 {
     $this->assertInstanceOf('Magento\\Framework\\View\\Layout\\ProcessorInterface', $this->_layout->getUpdate());
 }