/** * 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); }
/** * test for getVcl method */ public function testGetVcl() { $test = $this->_model->getVclFile(); $this->assertEquals(file_get_contents(__DIR__ . '/_files/result.vcl'), $test); }
/** * 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); }
/** * 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); }
/** * 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); }