Skip to content

Commit c3040d3

Browse files
author
Oleksii Korshenko
authored
Merge pull request #1050 from magento-engcom/develop-prs
Public Pull Requests: #9334 #9330 #9329 #9328
2 parents 6476ac9 + febe535 commit c3040d3

File tree

17 files changed

+227
-163
lines changed

17 files changed

+227
-163
lines changed

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

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* Magento configuration XML DOM utility
119
*/
@@ -120,7 +118,7 @@ public function __construct(
120118
/**
121119
* Retrieve array of xml errors
122120
*
123-
* @param $errorFormat
121+
* @param string $errorFormat
124122
* @return string[]
125123
*/
126124
private static function getXmlErrors($errorFormat)
@@ -171,15 +169,10 @@ protected function _mergeNode(\DOMElement $node, $parentPath)
171169
/* Update matched node attributes and value */
172170
if ($matchedNode) {
173171
//different node type
174-
if ($this->typeAttributeName && $node->hasAttribute(
175-
$this->typeAttributeName
176-
) && $matchedNode->hasAttribute(
177-
$this->typeAttributeName
178-
) && $node->getAttribute(
179-
$this->typeAttributeName
180-
) !== $matchedNode->getAttribute(
181-
$this->typeAttributeName
182-
)
172+
if ($this->typeAttributeName &&
173+
$node->hasAttribute($this->typeAttributeName) &&
174+
$matchedNode->hasAttribute($this->typeAttributeName) &&
175+
$node->getAttribute($this->typeAttributeName) !== $matchedNode->getAttribute($this->typeAttributeName)
183176
) {
184177
$parentMatchedNode = $this->_getMatchedNode($parentPath);
185178
$newNode = $this->dom->importNode($node, true);
@@ -247,7 +240,7 @@ protected function _mergeAttributes($baseNode, $mergeNode)
247240
*/
248241
protected function _getNodePathByParent(\DOMElement $node, $parentPath)
249242
{
250-
$prefix = is_null($this->rootNamespace) ? '' : self::ROOT_NAMESPACE_PREFIX . ':';
243+
$prefix = $this->rootNamespace === null ? '' : self::ROOT_NAMESPACE_PREFIX . ':';
251244
$path = $parentPath . '/' . $prefix . $node->tagName;
252245
$idAttribute = $this->nodeMergingConfig->getIdAttribute($path);
253246
if (is_array($idAttribute)) {
@@ -441,7 +434,7 @@ public function setSchemaFile($schemaFile)
441434
*/
442435
private function _getAttributeName($attribute)
443436
{
444-
if (!is_null($attribute->prefix) && !empty($attribute->prefix)) {
437+
if ($attribute->prefix !== null && !empty($attribute->prefix)) {
445438
$attributeName = $attribute->prefix . ':' . $attribute->name;
446439
} else {
447440
$attributeName = $attribute->name;

lib/internal/Magento/Framework/Config/Test/Unit/Composer/PackageTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Config\Test\Unit\Composer;
108

119
use \Magento\Framework\Config\Composer\Package;

lib/internal/Magento/Framework/Config/Test/Unit/DataTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Config\Test\Unit;
108

119
class DataTest extends \PHPUnit_Framework_TestCase
1210
{
13-
/**
11+
/**
1412
* @var \Magento\Framework\Config\ReaderInterface|\PHPUnit_Framework_MockObject_MockObject
1513
*/
1614
private $readerMock;

lib/internal/Magento/Framework/Controller/Test/Unit/Result/RedirectFactoryTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* See COPYING.txt for license details.
77
*/
88

9-
// @codingStandardsIgnoreFile
10-
119
namespace Magento\Framework\Controller\Test\Unit\Result;
1210

1311
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Css\Test\Unit\PreProcessor\Instruction;
108

119
use Magento\Framework\Css\PreProcessor\FileGenerator\RelatedGenerator;
@@ -40,13 +38,26 @@ protected function setUp()
4038
{
4139

4240
$this->notationResolver = $this->getMock(
43-
\Magento\Framework\View\Asset\NotationResolver\Module::class, [], [], '', false
41+
\Magento\Framework\View\Asset\NotationResolver\Module::class,
42+
[],
43+
[],
44+
'',
45+
false
4446
);
4547
$contextMock = $this->getMockForAbstractClass(
46-
\Magento\Framework\View\Asset\ContextInterface::class, [], '', false
48+
\Magento\Framework\View\Asset\ContextInterface::class,
49+
[],
50+
'',
51+
false
4752
);
4853
$contextMock->expects($this->any())->method('getPath')->willReturn('');
49-
$this->asset = $this->getMock(\Magento\Framework\View\Asset\File::class, [], [], '', false);
54+
$this->asset = $this->getMock(
55+
\Magento\Framework\View\Asset\File::class,
56+
[],
57+
[],
58+
'',
59+
false
60+
);
5061
$this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css'));
5162
$this->asset->expects($this->any())->method('getContext')->willReturn($contextMock);
5263

@@ -67,7 +78,12 @@ protected function setUp()
6778
*/
6879
public function testProcess($originalContent, $foundPath, $resolvedPath, $expectedContent)
6980
{
70-
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain($this->asset, $originalContent, 'less', 'path');
81+
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain(
82+
$this->asset,
83+
$originalContent,
84+
'less',
85+
'path'
86+
);
7187
$invoke = $this->once();
7288
if (preg_match('/^(http:|https:|\/+)/', $foundPath)) {
7389
$invoke = $this->never();
@@ -160,7 +176,12 @@ public function testProcessNoImport()
160176
$originalContent = 'color: #000000;';
161177
$expectedContent = 'color: #000000;';
162178

163-
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain($this->asset, $originalContent, 'css', 'path');
179+
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain(
180+
$this->asset,
181+
$originalContent,
182+
'css',
183+
'path'
184+
);
164185
$this->notationResolver->expects($this->never())
165186
->method('convertModuleNotationToPath');
166187
$this->object->process($chain);
@@ -186,7 +207,12 @@ public function testGetRelatedFiles()
186207
'path'
187208
);
188209
$this->object->process($chain);
189-
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain($this->asset, 'color: #000000;', 'css', 'path');
210+
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain(
211+
$this->asset,
212+
'color: #000000;',
213+
'css',
214+
'path'
215+
);
190216
$this->object->process($chain);
191217

192218
$expected = [['Magento_Module::something.css', $this->asset]];

lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Css\Test\Unit\PreProcessor\Instruction;
108

119
use Magento\Framework\Css\PreProcessor\Instruction\MagentoImport;
@@ -181,7 +179,10 @@ public function testProcessNoImport()
181179
public function testProcessException()
182180
{
183181
$chain = new \Magento\Framework\View\Asset\PreProcessor\Chain(
184-
$this->asset, '//@magento_import "some/file.css";', 'css', 'path'
182+
$this->asset,
183+
'//@magento_import "some/file.css";',
184+
'css',
185+
'path'
185186
);
186187
$exception = new \LogicException('Error happened');
187188
$this->assetRepo->expects($this->once())

lib/internal/Magento/Framework/Data/Form/Element/Editor.php

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\Data\Form\Element;
108

119
use Magento\Framework\Escaper;
@@ -123,7 +121,15 @@ public function getElementHtml()
123121
'
124122
<script type="text/javascript">
125123
//<![CDATA[
126-
window.tinyMCE_GZ = window.tinyMCE_GZ || {}; window.tinyMCE_GZ.loaded = true;require(["jquery", "mage/translate", "mage/adminhtml/events", "mage/adminhtml/wysiwyg/tiny_mce/setup", "mage/adminhtml/wysiwyg/widget"], function(jQuery){' .
124+
window.tinyMCE_GZ = window.tinyMCE_GZ || {};
125+
window.tinyMCE_GZ.loaded = true;
126+
require([
127+
"jquery",
128+
"mage/translate",
129+
"mage/adminhtml/events",
130+
"mage/adminhtml/wysiwyg/tiny_mce/setup",
131+
"mage/adminhtml/wysiwyg/widget"
132+
], function(jQuery){' .
127133
"\n" .
128134
' (function($) {$.mage.translate.add(' .
129135
\Zend_Json::encode(
@@ -254,9 +260,9 @@ protected function _getPluginButtonsHtml($visible = true)
254260
$buttonsHtml .= $this->_getButtonHtml(
255261
[
256262
'title' => $this->translate('Insert Widget...'),
257-
'onclick' => "widgetTools.openDialog('" . $this->getConfig(
258-
'widget_window_url'
259-
) . "widget_target_id/" . $this->getHtmlId() . "')",
263+
'onclick' => "widgetTools.openDialog('"
264+
. $this->getConfig('widget_window_url')
265+
. "widget_target_id/" . $this->getHtmlId() . "')",
260266
'class' => 'action-add-widget plugin',
261267
'style' => $visible ? '' : 'display:none',
262268
]
@@ -268,13 +274,12 @@ protected function _getPluginButtonsHtml($visible = true)
268274
$buttonsHtml .= $this->_getButtonHtml(
269275
[
270276
'title' => $this->translate('Insert Image...'),
271-
'onclick' => "MediabrowserUtility.openDialog('" . $this->getConfig(
272-
'files_browser_window_url'
273-
) . "target_element_id/" . $this->getHtmlId() . "/" . (null !== $this->getConfig(
274-
'store_id'
275-
) ? 'store/' . $this->getConfig(
276-
'store_id'
277-
) . '/' : '') . "')",
277+
'onclick' => "MediabrowserUtility.openDialog('"
278+
. $this->getConfig('files_browser_window_url')
279+
. "target_element_id/" . $this->getHtmlId() . "/"
280+
. (null !== $this->getConfig('store_id') ? 'store/'
281+
. $this->getConfig('store_id') . '/' : '')
282+
. "')",
278283
'class' => 'action-add-image plugin',
279284
'style' => $visible ? '' : 'display:none',
280285
]
@@ -389,13 +394,11 @@ protected function _wrapIntoContainer($html)
389394
return '<div class="admin__control-wysiwig">' .$html . '</div>';
390395
}
391396

392-
$html = '<div id="editor' . $this->getHtmlId() . '"' . ($this->getConfig(
393-
'no_display'
394-
) ? ' style="display:none;"' : '') . ($this->getConfig(
395-
'container_class'
396-
) ? ' class="admin__control-wysiwig ' . $this->getConfig(
397-
'container_class'
398-
) . '"' : '') . '>' . $html . '</div>';
397+
$html = '<div id="editor' . $this->getHtmlId() . '"'
398+
. ($this->getConfig('no_display') ? ' style="display:none;"' : '')
399+
. ($this->getConfig('container_class') ? ' class="admin__control-wysiwig '
400+
. $this->getConfig('container_class') . '"' : '')
401+
. '>' . $html . '</div>';
399402

400403
return $html;
401404
}

lib/internal/Magento/Framework/Data/Form/Element/Gallery.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**
108
* Category form input image element
119
*
@@ -43,10 +41,18 @@ public function getElementHtml()
4341
$gallery = $this->getValue();
4442

4543
$html = '<table id="gallery" class="gallery" border="0" cellspacing="3" cellpadding="0">';
46-
$html .= '<thead id="gallery_thead" class="gallery"><tr class="gallery"><td class="gallery" valign="middle" align="center">Big Image</td><td class="gallery" valign="middle" align="center">Thumbnail</td><td class="gallery" valign="middle" align="center">Small Thumb</td><td class="gallery" valign="middle" align="center">Sort Order</td><td class="gallery" valign="middle" align="center">Delete</td></tr></thead>';
44+
$html .= '<thead id="gallery_thead" class="gallery">' .
45+
'<tr class="gallery">' .
46+
'<td class="gallery" valign="middle" align="center">Big Image</td>' .
47+
'<td class="gallery" valign="middle" align="center">Thumbnail</td>' .
48+
'<td class="gallery" valign="middle" align="center">Small Thumb</td>' .
49+
'<td class="gallery" valign="middle" align="center">Sort Order</td>' .
50+
'<td class="gallery" valign="middle" align="center">Delete</td>' .
51+
'</tr>'.
52+
'</thead>';
4753
$widgetButton = $this->getForm()->getParent()->getLayout();
4854
$buttonHtml = $widgetButton->createBlock(
49-
\Magento\Backend\Block\Widget\Button::class
55+
\Magento\Backend\Block\Widget\Button::class
5056
)->setData(
5157
['label' => 'Add New Image', 'onclick' => 'addNewImg()', 'class' => 'add']
5258
)->toHtml();
@@ -60,7 +66,7 @@ public function getElementHtml()
6066
$html .= '<tbody class="gallery">';
6167

6268
$i = 0;
63-
if (!is_null($this->getValue())) {
69+
if ($this->getValue() !== null) {
6470
foreach ($this->getValue() as $image) {
6571
$i++;
6672
$html .= '<tr class="gallery">';
@@ -102,7 +108,8 @@ public function getElementHtml()
102108
'file'
103109
) . ' ></td>';
104110
}
105-
$html .= '<td class="gallery" align="center" style="vertical-align:bottom;"><input type="input" name="' .
111+
$html .= '<td class="gallery" align="center" style="vertical-align:bottom;">' .
112+
'<input type="input" name="' .
106113
parent::getName() .
107114
'[position][' .
108115
$image->getValueId() .
@@ -116,7 +123,8 @@ public function getElementHtml()
116123
$this->_getUiId(
117124
'position-' . $image->getValueId()
118125
) . '/></td>';
119-
$html .= '<td class="gallery" align="center" style="vertical-align:bottom;"><input type="checkbox" name="' .
126+
$html .= '<td class="gallery" align="center" style="vertical-align:bottom;">' .
127+
'<input type="checkbox" name="' .
120128
parent::getName() .
121129
'[delete][' .
122130
$image->getValueId() .
@@ -134,7 +142,9 @@ public function getElementHtml()
134142
}
135143
}
136144
if ($i == 0) {
137-
$html .= '<script type="text/javascript">document.getElementById("gallery_thead").style.visibility="hidden";</script>';
145+
$html .= '<script type="text/javascript">' .
146+
'document.getElementById("gallery_thead").style.visibility="hidden";' .
147+
'</script>';
138148
}
139149

140150
$html .= '</tbody></table>';

0 commit comments

Comments
 (0)