Skip to content

Commit bb1d132

Browse files
committed
Merge branch 'MAGETWO44227-FIX-TESTS' into 'master3'
MAGETWO44227: Fix statics and unit tests See merge request !163
2 parents 17d9535 + b15c61d commit bb1d132

File tree

2 files changed

+8
-56
lines changed

2 files changed

+8
-56
lines changed

lib/internal/Magento/Framework/Config/View.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,20 @@ class View extends \Magento\Framework\Config\Reader\Filesystem
2727
private $xsdReader;
2828

2929
/**
30-
* @param array $configFiles
31-
* @param UrnResolver $urnResolver
32-
* @param ValidationStateInterface $fileName
30+
* @param FileResolverInterface $fileResolver
3331
* @param ConverterInterface $converterInterface
3432
* @param SchemaLocatorInterface $schemaLocatorInterface
33+
* @param ValidationStateInterface $validationState
34+
* @param UrnResolver $urnResolver
35+
* @param array $fileName
3536
* @param array $xpath
3637
*/
3738
public function __construct(
38-
ValidationStateInterface $validationState,
39-
UrnResolver $urnResolver,
39+
FileResolverInterface $fileResolver,
4040
ConverterInterface $converterInterface,
4141
SchemaLocatorInterface $schemaLocatorInterface,
42-
FileResolverInterface $fileResolver,
42+
ValidationStateInterface $validationState,
43+
UrnResolver $urnResolver,
4344
$fileName,
4445
$xpath = []
4546
) {

lib/internal/Magento/Framework/View/Test/Unit/ConfigTest.php

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
4242

4343
protected function setUp()
4444
{
45-
$this->readerMock = $this->getMock('Magento\Framework\Module\Dir\Reader', [], [], '', false);
4645
$this->filesystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
4746
$this->directoryReadMock = $this->getMock('Magento\Framework\Filesystem\Directory\ReadInterface');
48-
$this->filesystemMock->expects($this->once())
49-
->method('getDirectoryRead')
50-
->with($this->equalTo(DirectoryList::ROOT))
51-
->will($this->returnValue($this->directoryReadMock));
5247
$this->repositoryMock = $this->getMock('Magento\Framework\View\Asset\Repository', [], [], '', false);
53-
$this->fileSystemMock = $this->getMock('Magento\Framework\View\FileSystem', [], [], '', false);
5448
$this->fileIteratorFactoryMock = $this->getMock(
5549
'Magento\Framework\Config\FileIteratorFactory',
5650
[],
@@ -63,10 +57,7 @@ protected function setUp()
6357
$this->config = $this->objectManagerHelper->getObject(
6458
'Magento\Framework\View\Config',
6559
[
66-
'moduleReader' => $this->readerMock,
67-
'filesystem' => $this->filesystemMock,
6860
'assetRepo' => $this->repositoryMock,
69-
'viewFileSystem' => $this->fileSystemMock,
7061
'fileIteratorFactory' => $this->fileIteratorFactoryMock,
7162
'viewConfigFactory' => $this->viewConfigFactoryMock
7263
]
@@ -77,55 +68,15 @@ public function testGetViewConfig()
7768
{
7869
$themeMock = $this->getMock(
7970
'Magento\Theme\Model\Theme',
80-
['getCode', 'getCustomization', 'getCustomViewConfigPath'],
71+
['getCustomViewConfigPath'],
8172
[],
8273
'',
8374
false
8475
);
85-
$themeMock->expects($this->atLeastOnce())
86-
->method('getCode')
87-
->will($this->returnValue(2));
88-
$themeMock->expects($this->once())
89-
->method('getCustomization')
90-
->will($this->returnSelf());
91-
$themeMock->expects($this->once())
92-
->method('getCustomViewConfigPath')
93-
->will($this->returnValue(''));
9476
$params = ['themeModel' => $themeMock];
95-
$configFile = 'config.xml';
96-
$this->repositoryMock->expects($this->atLeastOnce())
97-
->method('updateDesignParams')
98-
->with($this->equalTo($params))
99-
->will($this->returnSelf());
100-
$iterator = $this->getMock('Magento\Framework\Config\FileIterator', [], [], '', false);
101-
$iterator->expects($this->once())
102-
->method('toArray')
103-
->will($this->returnValue([]));
104-
$this->readerMock->expects($this->once())
105-
->method('getConfigurationFiles')
106-
->with($this->equalTo(basename(\Magento\Framework\View\ConfigInterface::CONFIG_FILE_NAME)))
107-
->will($this->returnValue($iterator));
108-
$this->directoryReadMock->expects($this->once())
109-
->method('isExist')
110-
->with($this->anything())
111-
->will($this->returnValue(true));
112-
$this->fileSystemMock->expects($this->once())
113-
->method('getFilename')
114-
->with($this->equalTo(\Magento\Framework\View\ConfigInterface::CONFIG_FILE_NAME), $params)
115-
->will($this->returnValue($configFile));
116-
$this->directoryReadMock->expects($this->any())
117-
->method('getRelativePath')
118-
->with($this->equalTo($configFile))
119-
->will($this->returnArgument(0));
120-
$xmlData = '<view><vars module="Magento_Catalog"><var name="test">1</var></vars></view>';
121-
$this->directoryReadMock->expects($this->once())
122-
->method('readFile')
123-
->with($this->equalTo($configFile))
124-
->will($this->returnValue($xmlData));
12577
$configViewMock = $this->getMock('Magento\Framework\Config\View', [], [], '', false);
12678
$this->viewConfigFactoryMock->expects($this->once())
12779
->method('create')
128-
->with([$configFile => $xmlData])
12980
->willReturn($configViewMock);
13081
$this->assertInstanceOf('Magento\Framework\Config\View', $this->config->getViewConfig($params));
13182
// lazy load test

0 commit comments

Comments
 (0)