Skip to content

Commit 3646356

Browse files
authored
Merge pull request #963 from magento-engcom/develop-prs
[EngCom] Public Pull Requests
2 parents 999a88b + 91b2e58 commit 3646356

File tree

12 files changed

+107
-15
lines changed

12 files changed

+107
-15
lines changed

app/code/Magento/Backend/Block/AnchorRenderer.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ public function __construct(
4949
public function renderAnchor($activeItem, Item $menuItem, $level)
5050
{
5151
if ($level == 1 && $menuItem->getUrl() == '#') {
52-
$output = '<strong class="submenu-group-title" role="presentation">'
53-
. '<span>' . $this->escaper->escapeHtml(__($menuItem->getTitle())) . '</span>'
54-
. '</strong>';
52+
$output = '';
53+
if ($menuItem->hasChildren()) {
54+
$output = '<strong class="submenu-group-title" role="presentation">'
55+
. '<span>' . $this->escaper->escapeHtml(__($menuItem->getTitle())) . '</span>'
56+
. '</strong>';
57+
}
5558
} else {
5659
$target = $menuItem->getTarget() ? ('target=' . $menuItem->getTarget()) : '';
5760
$output = '<a href="' . $menuItem->getUrl() . '" ' . $target . ' ' . $this->_renderItemAnchorTitle(

app/code/Magento/Backend/Test/Unit/Block/AnchorRendererTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ protected function setUp()
5151
$this->menuItemMock = $this->getMockBuilder(Item::class)
5252
->disableOriginalConstructor()
5353
->getMock();
54+
$this->menuItemWithoutChildrenMock = $this->getMockBuilder(Item::class)
55+
->disableOriginalConstructor()
56+
->getMock();
5457
$this->menuItemCheckerMock = $this->getMockBuilder(MenuItemChecker::class)
5558
->disableOriginalConstructor()
5659
->getMock();
@@ -74,6 +77,7 @@ public function testRenderAnchorLevelIsOne()
7477
$html = 'Test html';
7578
$this->menuItemMock->expects($this->once())->method('getUrl')->willReturn('#');
7679
$this->menuItemMock->expects($this->once())->method('getTitle')->willReturn($title);
80+
$this->menuItemMock->expects($this->once())->method('hasChildren')->willReturn(true);
7781
$this->escaperMock->expects($this->once())->method('escapeHtml')->with(__($title))->willReturn($html);
7882

7983
$expected = '<strong class="submenu-group-title" role="presentation">'
@@ -86,6 +90,19 @@ public function testRenderAnchorLevelIsOne()
8690
);
8791
}
8892

93+
public function testRenderAnchorWithoutChildrenAndLevelIsOne()
94+
{
95+
$this->menuItemWithoutChildrenMock->expects($this->once())->method('getUrl')->willReturn('#');
96+
$this->menuItemWithoutChildrenMock->expects($this->once())->method('hasChildren')->willReturn(false);
97+
98+
$expected = '';
99+
100+
$this->assertEquals(
101+
$expected,
102+
$this->anchorRenderer->renderAnchor($this->activeMenuItemMock, $this->menuItemWithoutChildrenMock, 1)
103+
);
104+
}
105+
89106
/**
90107
* @param bool $hasTarget
91108
* @dataProvider targetDataProvider

app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ private function prepareMeta()
181181
'value' => '1',
182182
'dataScope' => $fieldCode . '.is_in_stock',
183183
'scopeLabel' => '[GLOBAL]',
184+
'imports' => [
185+
'visible' => '${$.provider}:data.product.stock_data.manage_stock',
186+
],
184187
]
185188
);
186189
$this->meta = $this->arrayManager->merge(

app/code/Magento/Cms/Model/BlockRepository.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ public function __construct(
110110
*/
111111
public function save(Data\BlockInterface $block)
112112
{
113-
$storeId = $this->storeManager->getStore()->getId();
114-
$block->setStoreId($storeId);
113+
if (empty($block->getStoreId())) {
114+
$block->setStoreId($this->storeManager->getStore()->getId());
115+
}
116+
115117
try {
116118
$this->resource->save($block);
117119
} catch (\Exception $exception) {

app/code/Magento/Email/Model/Source/Variables.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct()
6161
public function toOptionArray($withGroup = false)
6262
{
6363
$optionArray = [];
64-
foreach ($this->_configVariables as $variable) {
64+
foreach ($this->getData() as $variable) {
6565
$optionArray[] = [
6666
'value' => '{{config path="' . $variable['value'] . '"}}',
6767
'label' => $variable['label'],
@@ -81,6 +81,6 @@ public function toOptionArray($withGroup = false)
8181
*/
8282
public function getData()
8383
{
84-
return $this->_configVariables;
84+
return $this->_configVariables;
8585
}
8686
}

app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212
namespace Magento\Reports\Model\ResourceModel\Product\Sold;
1313

14+
use Magento\Framework\DB\Select;
15+
1416
/**
1517
* @SuppressWarnings(PHPMD.DepthOfInheritance)
1618
*/
@@ -109,6 +111,19 @@ public function setOrder($attribute, $dir = self::SORT_ORDER_DESC)
109111
return $this;
110112
}
111113

114+
/**
115+
* @return Select
116+
*/
117+
public function getSelectCountSql()
118+
{
119+
$countSelect = clone parent::getSelectCountSql();
120+
121+
$countSelect->reset(Select::COLUMNS);
122+
$countSelect->columns('COUNT(DISTINCT order_items.item_id)');
123+
124+
return $countSelect;
125+
}
126+
112127
/**
113128
* Prepare between sql
114129
*
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Reports\Test\Unit\Model\ResourceModel\Product\Sold\Collection;
8+
9+
use Magento\Framework\DB\Select;
10+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
11+
use Magento\Reports\Model\ResourceModel\Product\Sold\Collection;
12+
13+
/**
14+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
15+
*/
16+
class CollectionTest extends \PHPUnit_Framework_TestCase
17+
{
18+
/**
19+
* @var ObjectManager
20+
*/
21+
protected $objectManager;
22+
23+
/**
24+
* @var \PHPUnit_Framework_MockObject_MockObject
25+
*/
26+
protected $selectMock;
27+
28+
protected function setUp()
29+
{
30+
$this->objectManager = new ObjectManager($this);
31+
$this->selectMock = $this->getMock(Select::class, [], [], '', false);
32+
}
33+
34+
public function testGetSelectCountSql()
35+
{
36+
/** @var $collection \PHPUnit_Framework_MockObject_MockObject */
37+
$constructArgs = $this->objectManager->getConstructArguments(Collection::class);
38+
$collection = $this->getMock(Collection::class, ['getSelect'], $constructArgs, '', false);
39+
40+
$collection->expects($this->atLeastOnce())->method('getSelect')->willReturn($this->selectMock);
41+
42+
$this->selectMock->expects($this->atLeastOnce())->method('reset')->willReturnSelf();
43+
$this->selectMock->expects($this->exactly(2))->method('columns')->willReturnSelf();
44+
45+
$this->selectMock->expects($this->at(6))->method('columns')->with('COUNT(DISTINCT main_table.entity_id)');
46+
47+
$this->selectMock->expects($this->at(7))->method('reset')->with(Select::COLUMNS);
48+
$this->selectMock->expects($this->at(8))->method('columns')->with('COUNT(DISTINCT order_items.item_id)');
49+
50+
$this->assertEquals($this->selectMock, $collection->getSelectCountSql());
51+
}
52+
}

app/code/Magento/Review/Controller/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function dispatch(RequestInterface $request)
155155
if (!$this->customerSession->isLoggedIn()) {
156156
$this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
157157
$this->customerSession->setBeforeAuthUrl($this->_url->getUrl('*/*/*', ['_current' => true]));
158-
$this->_reviewSession->setFormData(
158+
$this->reviewSession->setFormData(
159159
$request->getPostValue()
160160
)->setRedirectUrl(
161161
$this->_redirect->getRefererUrl()

app/code/Magento/Rule/Model/AbstractModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ protected function _convertFlatToRecursive(array $data)
352352
/**
353353
* Convert dates into \DateTime
354354
*/
355-
if (in_array($key, ['from_date', 'to_date']) && $value) {
355+
if (in_array($key, ['from_date', 'to_date'], true) && $value) {
356356
$value = new \DateTime($value);
357357
}
358358
$this->setData($key, $value);

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ define([
136136
drEl.instanceCtx = this.getRecord(originRecord[0]);
137137
drEl.eventMousedownY = isTouchDevice ? event.originalEvent.touches[0].pageY : event.pageY;
138138
drEl.minYpos =
139-
$table.offset().top - originRecord.offset().top + $table.find('thead').outerHeight();
140-
drEl.maxYpos = drEl.minYpos + $table.find('tbody').outerHeight() - originRecord.outerHeight();
139+
$table.offset().top - originRecord.offset().top + $table.children('thead').outerHeight();
140+
drEl.maxYpos = drEl.minYpos + $table.children('tbody').outerHeight() - originRecord.outerHeight();
141141
$tableWrapper.append(recordNode);
142142

143143
if (isTouchDevice) {

0 commit comments

Comments
 (0)