Skip to content

Commit 679ef90

Browse files
committed
Merge branch 'MAGETWO-PR42-FIX-INTEGREATION-TESTS' into 'master4'
MAGETWO: fix integration tests for PR42 See merge request !170
2 parents 94b5a41 + 5b3e2d0 commit 679ef90

File tree

1 file changed

+49
-2
lines changed
  • dev/tests/integration/testsuite/Magento/Theme/Model/View

1 file changed

+49
-2
lines changed

dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,60 @@ public function testGetConfigurationDesignThemeStore()
145145
);
146146
}
147147

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+
148171
/**
149172
* @magentoAppIsolation enabled
150173
*/
151174
public function testGetViewConfig()
152175
{
153176
$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);
156202
}
157203

158204
/**
@@ -180,6 +226,7 @@ public function testGetConfigCustomized()
180226

181227
$config = $this->_viewConfig->getViewConfig();
182228
$this->assertInstanceOf('Magento\Framework\Config\View', $config);
229+
$this->assertEquals(['customVar' => 'custom value'], $config->getVars('Namespace_Module'));
183230
} catch (\Exception $e) {
184231
$directory->delete($relativePath);
185232
throw $e;

0 commit comments

Comments
 (0)