Ejemplo n.º 1
0
 /**
  * Export Varnish Configuration as .vcl
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function executeInternal()
 {
     $fileName = 'varnish.vcl';
     $varnishVersion = $this->getRequest()->getParam('varnish');
     switch ($varnishVersion) {
         case 3:
             $content = $this->config->getVclFile(\Magento\PageCache\Model\Config::VARNISH_3_CONFIGURATION_PATH);
             break;
         default:
             $content = $this->config->getVclFile(\Magento\PageCache\Model\Config::VARNISH_4_CONFIGURATION_PATH);
             break;
     }
     return $this->fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
 }
Ejemplo n.º 2
0
 /**
  * test for getVcl method
  */
 public function testGetVcl()
 {
     $test = $this->_model->getVclFile();
     $this->assertEquals(file_get_contents(__DIR__ . '/_files/result.vcl'), $test);
 }
Ejemplo n.º 3
0
 /**
  * Export Varnish Configuration as .vcl
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute()
 {
     $fileName = 'varnish.vcl';
     $content = $this->config->getVclFile();
     return $this->fileFactory->create($fileName, $content, \Magento\Framework\App\Filesystem::VAR_DIR);
 }
Ejemplo n.º 4
0
 /**
  * test for getVcl method
  */
 public function testGetVcl()
 {
     $test = $this->_model->getVclFile(Config::VARNISH_3_CONFIGURATION_PATH);
     $this->assertEquals(file_get_contents(__DIR__ . '/_files/result.vcl'), $test);
 }
Ejemplo n.º 5
0
 /**
  * test for getVcl method
  */
 public function testGetVcl()
 {
     $this->moduleReader->expects($this->once())->method('getModuleDir')->willReturn('/magento/app/code/Magento/PageCache');
     $test = $this->_model->getVclFile(Config::VARNISH_3_CONFIGURATION_PATH);
     $this->assertEquals(file_get_contents(__DIR__ . '/_files/result.vcl'), $test);
 }