@@ -145,14 +145,60 @@ public function testGetConfigurationDesignThemeStore()
145
145
);
146
146
}
147
147
148
+ /**
149
+ * @dataProvider getFilenameDataProvider
150
+ * @magentoAppIsolation enabled
151
+ */
152
+ public function testGetFilename ($ file , $ params )
153
+ {
154
+ $ this ->_emulateFixtureTheme ();
155
+ $ this ->assertFileExists ($ this ->_viewFileSystem ->getFilename ($ file , $ params ));
156
+ }
157
+
158
+ /**
159
+ * @return array
160
+ */
161
+ public function getFilenameDataProvider ()
162
+ {
163
+ return [
164
+ ['theme_file.txt ' , ['module ' => 'Magento_Catalog ' ]],
165
+ ['Magento_Catalog::theme_file.txt ' , []],
166
+ ['Magento_Catalog::theme_file_with_2_dots..txt ' , []],
167
+ ['Magento_Catalog::theme_file.txt ' , ['module ' => 'Overridden_Module ' ]]
168
+ ];
169
+ }
170
+
148
171
/**
149
172
* @magentoAppIsolation enabled
150
173
*/
151
174
public function testGetViewConfig ()
152
175
{
153
176
$ this ->_emulateFixtureTheme ();
154
- $ config = $ this ->_viewConfig ->getViewConfig ();
155
- $ this ->assertInstanceOf ('Magento\Framework\Config\View ' , $ config );
177
+ /** @var $theme \Magento\Framework\View\Design\ThemeInterface */
178
+ $ theme = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->get (
179
+ 'Magento\Framework\View\DesignInterface '
180
+ )->getDesignTheme ();
181
+ $ customConfigFile = $ theme ->getCustomization ()->getCustomViewConfigPath ();
182
+ /** @var $filesystem \Magento\Framework\Filesystem */
183
+ $ filesystem = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()
184
+ ->create ('Magento\Framework\Filesystem ' );
185
+ $ directory = $ filesystem ->getDirectoryWrite (DirectoryList::ROOT );
186
+ $ relativePath = $ directory ->getRelativePath ($ customConfigFile );
187
+ try {
188
+ $ directory ->writeFile (
189
+ $ relativePath ,
190
+ '<?xml version="1.0" encoding="UTF-8"?>
191
+ <view><vars module="Namespace_Module"><var name="var">var value</var></vars></view> '
192
+ );
193
+
194
+ $ config = $ this ->_viewConfig ->getViewConfig ();
195
+ $ this ->assertInstanceOf ('Magento\Framework\Config\View ' , $ config );
196
+ $ this ->assertEquals ('var value ' , $ config ->getVarValue ('Namespace_Module ' , 'var ' ));
197
+ } catch (\Exception $ e ) {
198
+ $ directory ->delete ($ relativePath );
199
+ throw $ e ;
200
+ }
201
+ $ directory ->delete ($ relativePath );
156
202
}
157
203
158
204
/**
@@ -180,6 +226,7 @@ public function testGetConfigCustomized()
180
226
181
227
$ config = $ this ->_viewConfig ->getViewConfig ();
182
228
$ this ->assertInstanceOf ('Magento\Framework\Config\View ' , $ config );
229
+ $ this ->assertEquals (['customVar ' => 'custom value ' ], $ config ->getVars ('Namespace_Module ' ));
183
230
} catch (\Exception $ e ) {
184
231
$ directory ->delete ($ relativePath );
185
232
throw $ e ;
0 commit comments