Skip to content

Commit 20a2d90

Browse files
author
Igor Miniailo
committed
Merge branch 'PR4' into product-video-PR4
2 parents cf27895 + a35c22c commit 20a2d90

File tree

5 files changed

+22
-65
lines changed

5 files changed

+22
-65
lines changed

app/code/Magento/ProductVideo/Test/Unit/Helper/MediaTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,4 @@ public function testGetYouTubeApiKey()
9999
$this->helper->getYouTubeApiKey()
100100
);
101101
}
102-
103102
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function convert($source)
4848
/**
4949
* Parse node values from xml nodes
5050
*
51-
* @param $childNode
51+
* @param \DOMElement $childNode
5252
* @return array
5353
*/
5454
protected function parseNodes($childNode)

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\Filesystem;
1212
use Magento\Framework\View\DesignInterface;
1313
use Magento\Framework\App\Filesystem\DirectoryList;
14+
use Symfony\Component\Config\Definition\Exception\Exception;
1415

1516
class FileResolver implements \Magento\Framework\Config\FileResolverInterface
1617
{
@@ -45,14 +46,12 @@ class FileResolver implements \Magento\Framework\Config\FileResolverInterface
4546
* @param \Magento\Framework\Module\Dir\Reader $moduleReader
4647
* @param FileIteratorFactory $iteratorFactory
4748
* @param DesignInterface $designInterface
48-
* @param \Magento\Framework\Filesystem $filesystem
4949
* @param DirectoryList $directoryList
5050
*/
5151
public function __construct(
5252
Reader $moduleReader,
5353
FileIteratorFactory $iteratorFactory,
5454
DesignInterface $designInterface,
55-
Filesystem $filesystem,
5655
DirectoryList $directoryList
5756
) {
5857
$this->directoryList = $directoryList;
@@ -78,9 +77,14 @@ public function get($filename, $scope)
7877
. '/'
7978
. $this->themePath
8079
. '/etc/view.xml';
81-
$designDom = new \DOMDocument;
82-
$designDom->load($designPath);
83-
$iterator[$designPath] = $designDom->saveXML();
80+
if (file_exists($designPath)) {
81+
try {
82+
$designDom = new \DOMDocument;
83+
$designDom->load($designPath);
84+
$iterator[$designPath] = $designDom->saveXML();
85+
} catch (Exception $e) {
86+
}
87+
}
8488
break;
8589
default:
8690
$iterator = $this->iteratorFactory->create([]);

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

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313

1414
class View extends \Magento\Framework\Config\Reader\Filesystem
1515
{
16-
/** @var UrnResolver */
17-
protected $urnResolver;
18-
1916
/**
2017
* @var array
2118
*/
@@ -27,7 +24,6 @@ class View extends \Magento\Framework\Config\Reader\Filesystem
2724
* @param SchemaLocatorInterface $schemaLocator
2825
* @param ValidationStateInterface $validationState
2926
* @param string $fileName
30-
* @param UrnResolver $urnResolver
3127
* @param array $idAttributes
3228
* @param string $domDocumentClass
3329
* @param string $defaultScope
@@ -39,15 +35,13 @@ public function __construct(
3935
SchemaLocatorInterface $schemaLocator,
4036
ValidationStateInterface $validationState,
4137
$fileName,
42-
UrnResolver $urnResolver,
4338
$idAttributes = [],
4439
$domDocumentClass = 'Magento\Framework\Config\Dom',
4540
$defaultScope = 'global',
4641
$xpath = []
4742
) {
4843
$this->xpath = $xpath;
49-
$this->urnResolver = $urnResolver;
50-
$idAttributes = $this->_getIdAttributes();
44+
$idAttributes = $this->getIdAttributes();
5145
parent::__construct(
5246
$fileResolver,
5347
$converter,
@@ -61,16 +55,6 @@ public function __construct(
6155
$this->data = $this->read();
6256
}
6357

64-
/**
65-
* Path to view.xsd
66-
*
67-
* @return string
68-
*/
69-
public function getSchemaFile()
70-
{
71-
return $this->urnResolver->getRealPath('urn:magento:framework:Config/etc/view.xsd');
72-
}
73-
7458
/**
7559
* Get a list of variables in scope of specified module
7660
*
@@ -151,26 +135,14 @@ public function getDomConfigCopy()
151135
*
152136
* @return array
153137
*/
154-
protected function _getIdAttributes()
155-
{
156-
$idAttributes = $this->addIdAttributes($this->xpath);
157-
return $idAttributes;
158-
}
159-
160-
/**
161-
* Add attributes for module identification
162-
*
163-
* @param array $xpath
164-
* @return array
165-
*/
166-
protected function addIdAttributes($xpath)
138+
protected function getIdAttributes()
167139
{
168140
$idAttributes = [
169141
'/view/vars' => 'module',
170142
'/view/vars/var' => 'name',
171143
'/view/exclude/item' => ['type', 'item'],
172144
];
173-
foreach ($xpath as $attribute) {
145+
foreach ($this->xpath as $attribute) {
174146
if (is_array($attribute)) {
175147
foreach ($attribute as $key => $id) {
176148
if (count($id) > 1) {

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

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,24 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
1717
/** @var ObjectManagerHelper */
1818
protected $objectManagerHelper;
1919

20-
/** @var \Magento\Framework\Module\Dir\Reader | \PHPUnit_Framework_MockObject_MockObject */
21-
protected $readerMock;
22-
23-
/** @var \Magento\Framework\Filesystem | \PHPUnit_Framework_MockObject_MockObject */
24-
protected $filesystemMock;
25-
2620
/** @var \Magento\Framework\View\Asset\Repository | \PHPUnit_Framework_MockObject_MockObject */
2721
protected $repositoryMock;
2822

29-
/** @var \Magento\Framework\View\FileSystem | \PHPUnit_Framework_MockObject_MockObject */
30-
protected $fileSystemMock;
31-
32-
/** @var \Magento\Framework\Config\FileIteratorFactory | \PHPUnit_Framework_MockObject_MockObject */
33-
protected $fileIteratorFactoryMock;
34-
35-
/** @var \Magento\Framework\Filesystem\Directory\ReadInterface | \PHPUnit_Framework_MockObject_MockObject */
36-
protected $directoryReadMock;
37-
3823
/**
3924
* @var \Magento\Framework\Config\ViewFactory | \PHPUnit_Framework_MockObject_MockObject
4025
*/
4126
protected $viewConfigFactoryMock;
4227

4328
protected function setUp()
4429
{
45-
$this->filesystemMock = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
46-
$this->directoryReadMock = $this->getMock('Magento\Framework\Filesystem\Directory\ReadInterface');
4730
$this->repositoryMock = $this->getMock('Magento\Framework\View\Asset\Repository', [], [], '', false);
48-
$this->fileIteratorFactoryMock = $this->getMock(
49-
'Magento\Framework\Config\FileIteratorFactory',
50-
[],
51-
[],
52-
'',
53-
false
54-
);
5531
$this->viewConfigFactoryMock = $this->getMock('Magento\Framework\Config\ViewFactory', [], [], '', false);
5632
$this->objectManagerHelper = new ObjectManagerHelper($this);
5733
$this->config = $this->objectManagerHelper->getObject(
5834
'Magento\Framework\View\Config',
5935
[
6036
'assetRepo' => $this->repositoryMock,
61-
'fileIteratorFactory' => $this->fileIteratorFactoryMock,
62-
'viewFactory' => $this->viewConfigFactoryMock
37+
'viewConfigFactory' => $this->viewConfigFactoryMock
6338
]
6439
);
6540
}
@@ -68,12 +43,19 @@ public function testGetViewConfig()
6843
{
6944
$themeMock = $this->getMock(
7045
'Magento\Theme\Model\Theme',
71-
['getCustomViewConfigPath'],
46+
['getCode'],
7247
[],
7348
'',
7449
false
7550
);
51+
$themeMock->expects($this->atLeastOnce())
52+
->method('getCode')
53+
->will($this->returnValue(2));
7654
$params = ['themeModel' => $themeMock];
55+
$this->repositoryMock->expects($this->atLeastOnce())
56+
->method('updateDesignParams')
57+
->with($this->equalTo($params))
58+
->will($this->returnSelf());
7759
$configViewMock = $this->getMock('Magento\Framework\Config\View', [], [], '', false);
7860
$this->viewConfigFactoryMock->expects($this->once())
7961
->method('create')

0 commit comments

Comments
 (0)