/** * Test Setup * * @return void */ public function setUp() { $this->_fileSystemMock = $this->getMock('\\Magento\\Framework\\Filesystem', [], [], '', false); $this->_scopeConfigMock = $this->getMock('\\Magento\\Framework\\App\\Config\\ScopeConfigInterface'); $this->rootDirectoryMock = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\ReadInterface'); $this->compiledDirectoryMock = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\ReadInterface'); $this->_fileSystemMock->expects($this->any())->method('getDirectoryRead')->will($this->returnValueMap([[DirectoryList::ROOT, DriverPool::FILE, $this->rootDirectoryMock], [DirectoryList::TEMPLATE_MINIFICATION_DIR, DriverPool::FILE, $this->compiledDirectoryMock]])); $this->compiledDirectoryMock->expects($this->any())->method('getAbsolutePath')->will($this->returnValue('/magento/var/compiled')); $this->componentRegistrar = $this->getMock('Magento\\Framework\\Component\\ComponentRegistrar', [], [], '', false); $this->componentRegistrar->expects($this->any())->method('getPaths')->will($this->returnValueMap([[ComponentRegistrar::MODULE, ['/magento/app/code/Some/Module']], [ComponentRegistrar::THEME, ['/magento/themes/default']]])); $this->_validator = new \Magento\Framework\View\Element\Template\File\Validator($this->_fileSystemMock, $this->_scopeConfigMock, $this->componentRegistrar); }
/** * Test Setup * * @return void */ public function setUp() { $this->_fileSystemMock = $this->getMock('\Magento\Framework\Filesystem', [], [], '', false); $this->_scopeConfigMock = $this->getMock('\Magento\Framework\App\Config\ScopeConfigInterface'); $this->rootDirectoryMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface'); $this->appDirectoryMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface'); $this->themesDirectoryMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface'); $this->compiledDirectoryMock = $this->getMock('\Magento\Framework\Filesystem\Directory\ReadInterface'); $this->_fileSystemMock->expects($this->any()) ->method('getDirectoryRead') ->will($this->returnValueMap( [ [DirectoryList::ROOT, DriverPool::FILE, $this->rootDirectoryMock], [DirectoryList::THEMES, DriverPool::FILE, $this->themesDirectoryMock], [DirectoryList::APP, DriverPool::FILE, $this->appDirectoryMock], [DirectoryList::TEMPLATE_MINIFICATION_DIR, DriverPool::FILE, $this->compiledDirectoryMock], ] )); $this->compiledDirectoryMock->expects($this->any()) ->method('getAbsolutePath') ->will($this->returnValue('/magento/var/compiled')); $this->appDirectoryMock->expects($this->any()) ->method('getAbsolutePath') ->will($this->returnValue('/magento/app')); $this->themesDirectoryMock->expects($this->any()) ->method('getAbsolutePath') ->will($this->returnValue('/magento/themes')); $this->_validator = new \Magento\Framework\View\Element\Template\File\Validator( $this->_fileSystemMock, $this->_scopeConfigMock ); }