52 $this->_fileResolution = $this->createMock(\
Magento\Framework\View\Design\FileResolution\Fallback\File::class);
53 $this->_templateFileResolution = $this->createMock(
54 \
Magento\Framework\View\Design\FileResolution\Fallback\TemplateFile::class
56 $this->_localeFileResolution = $this->createMock(
57 \
Magento\Framework\View\Design\FileResolution\Fallback\LocaleFile::class
59 $this->_staticFileResolution = $this->createMock(
60 \
Magento\Framework\View\Design\FileResolution\Fallback\StaticFile::class
62 $this->_emailTemplateFileResolution = $this->createMock(
63 \
Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile::class
65 $this->_assetRepo = $this->createPartialMock(
67 [
'extractScope',
'updateDesignParams',
'createAsset']
70 $this->_model = new \Magento\Framework\View\FileSystem(
71 $this->_fileResolution,
72 $this->_templateFileResolution,
73 $this->_localeFileResolution,
74 $this->_staticFileResolution,
75 $this->_emailTemplateFileResolution,
83 'area' =>
'some_area',
84 'themeModel' => $this->createMock(\
Magento\Framework\View\Design\ThemeInterface::class),
85 'module' =>
'Some_Module',
88 $file =
'Some_Module::some_file.ext';
89 $expected =
'path/to/some_file.ext';
91 $this->_fileResolution->expects($this->once())
93 ->with(
$params[
'area'],
$params[
'themeModel'],
'some_file.ext',
'Some_Module')
94 ->will($this->returnValue($expected));
96 $this->_assetRepo->expects($this->any())
97 ->method(
'extractScope')
99 ->will($this->returnValue(
'some_file.ext'));
101 $actual = $this->_model->getFilename($file,
$params);
102 $this->assertEquals($expected, $actual);
108 'area' =>
'some_area',
109 'themeModel' => $this->createMock(\
Magento\Framework\View\Design\ThemeInterface::class),
110 'module' =>
'Some_Module',
113 $file =
'Some_Module::some_file.ext';
114 $expected =
'path/to/some_file.ext';
116 $this->_templateFileResolution->expects($this->once())
118 ->with(
$params[
'area'],
$params[
'themeModel'],
'some_file.ext',
'Some_Module')
119 ->will($this->returnValue($expected));
121 $this->_assetRepo->expects($this->any())
122 ->method(
'extractScope')
124 ->will($this->returnValue(
'some_file.ext'));
126 $actual = $this->_model->getTemplateFileName($file,
$params);
127 $this->assertEquals($expected, $actual);
133 'area' =>
'some_area',
134 'themeModel' => $this->createMock(\
Magento\Framework\View\Design\ThemeInterface::class),
135 'locale' =>
'some_locale',
137 $file =
'some_file.ext';
138 $expected =
'path/to/some_file.ext';
140 $this->_localeFileResolution->expects($this->once())
143 ->will($this->returnValue($expected));
145 $actual = $this->_model->getLocaleFileName($file,
$params);
146 $this->assertEquals($expected, $actual);
152 'area' =>
'some_area',
153 'themeModel' => $this->createMock(\
Magento\Framework\View\Design\ThemeInterface::class),
154 'locale' =>
'some_locale',
155 'module' =>
'Some_Module',
157 $file =
'Some_Module::some_file.ext';
158 $expected =
'path/to/some_file.ext';
160 $this->_staticFileResolution->expects($this->once())
163 ->will($this->returnValue($expected));
165 $actual = $this->_model->getStaticFileName($file,
$params);
166 $this->assertEquals($expected, $actual);
177 $this->assertEquals($expectedResult,
$result);
186 'standard path' => [
'/dir/somedir/somefile.ext',
'/dir/somedir/somefile.ext'],
187 'one dot path' => [
'/dir/somedir/./somefile.ext',
'/dir/somedir/somefile.ext'],
188 'two dots path' => [
'/dir/somedir/../somefile.ext',
'/dir/somefile.ext'],
189 'two times two dots path' => [
'/dir/../somedir/../somefile.ext',
'/somefile.ext']
201 $result = $this->_model->offsetPath($relatedPath,
$path);
202 $this->assertEquals($expectedResult,
$result);
212 '/some/directory/two/another/file.ext',
213 '/some/directory/one/file.ext',
216 'local path reverted' => [
217 '/some/directory/one/file.ext',
218 '/some/directory/two/another/file.ext',
222 'http://example.com/images/logo.gif',
223 'http://example.com/themes/demo/css/styles.css',
227 '/some/directory/file.ext',
228 '/some/directory/file1.ext',
231 'non-normalized' => [
232 '/some/directory/../one/file.ext',
233 '/some/directory/./two/another/file.ext',
241 $locale = \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE;
243 'area' =>
'some_area',
244 'themeModel' => $this->createMock(\
Magento\Framework\View\Design\ThemeInterface::class),
245 'module' =>
'Some_Module',
248 $file =
'Some_Module::some_file.ext';
249 $expected =
'path/to/some_file.ext';
251 $this->_emailTemplateFileResolution->expects($this->once())
253 ->with(
$params[
'area'],
$params[
'themeModel'], $locale, $file,
'Some_Module')
254 ->will($this->returnValue($expected));
256 $actual = $this->_model->getEmailTemplateFileName($file,
$params,
'Some_Module');
257 $this->assertEquals($expected, $actual);
testGetTemplateFileName()
testNormalizePath($path, $expectedResult)
normalizePathDataProvider()
$_emailTemplateFileResolution
testOffsetPath($relatedPath, $path, $expectedResult)
testGetEmailTemplateFile()
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]