Skip to content

Commit 4dc5ad6

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into MAGETWO-95653
2 parents 07e0adb + a72f59b commit 4dc5ad6

File tree

12 files changed

+315
-58
lines changed

12 files changed

+315
-58
lines changed

app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -469,26 +469,6 @@ define([
469469
}
470470
},
471471

472-
/**
473-
* toggles Selects states (for IE) except those to be shown in popup
474-
*/
475-
/*_toggleSelectsExceptBlock: function(flag) {
476-
if(Prototype.Browser.IE){
477-
if (this.blockForm) {
478-
var states = new Array;
479-
var selects = this.blockForm.getElementsByTagName("select");
480-
for(var i=0; i<selects.length; i++){
481-
states[i] = selects[i].style.visibility
482-
}
483-
}
484-
if (this.blockForm) {
485-
for(i=0; i<selects.length; i++){
486-
selects[i].style.visibility = states[i]
487-
}
488-
}
489-
}
490-
},*/
491-
492472
/**
493473
* Close configuration window
494474
*/

app/code/Magento/Checkout/Controller/Sidebar/UpdateItemQty.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ public function __construct(
5050
}
5151

5252
/**
53-
* @return $this
53+
* @inheritdoc
5454
*/
5555
public function execute()
5656
{
5757
$itemId = (int)$this->getRequest()->getParam('item_id');
58-
$itemQty = (int)$this->getRequest()->getParam('item_qty');
58+
$itemQty = $this->getRequest()->getParam('item_qty');
5959

6060
try {
6161
$this->sidebar->checkQuoteItem($itemId);

app/code/Magento/Checkout/Test/Unit/Controller/Sidebar/UpdateItemQtyTest.php

Lines changed: 61 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,46 @@
55
*/
66
namespace Magento\Checkout\Test\Unit\Controller\Sidebar;
77

8+
use Magento\Checkout\Controller\Sidebar\UpdateItemQty;
9+
use Magento\Checkout\Model\Sidebar;
10+
use Magento\Framework\App\RequestInterface;
11+
use Magento\Framework\App\ResponseInterface;
812
use Magento\Framework\Exception\LocalizedException;
13+
use Magento\Framework\Json\Helper\Data;
914
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
15+
use Psr\Log\LoggerInterface;
1016

1117
class UpdateItemQtyTest extends \PHPUnit\Framework\TestCase
1218
{
13-
/** @var \Magento\Checkout\Controller\Sidebar\UpdateItemQty */
14-
protected $updateItemQty;
19+
/** @var UpdateItemQty */
20+
private $updateItemQty;
1521

1622
/** @var ObjectManagerHelper */
17-
protected $objectManagerHelper;
23+
private $objectManagerHelper;
1824

19-
/** @var \Magento\Checkout\Model\Sidebar|\PHPUnit_Framework_MockObject_MockObject */
20-
protected $sidebarMock;
25+
/** @var Sidebar|\PHPUnit_Framework_MockObject_MockObject */
26+
private $sidebarMock;
2127

22-
/** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */
23-
protected $loggerMock;
28+
/** @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */
29+
private $loggerMock;
2430

25-
/** @var \Magento\Framework\Json\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */
26-
protected $jsonHelperMock;
31+
/** @var Data|\PHPUnit_Framework_MockObject_MockObject */
32+
private $jsonHelperMock;
2733

28-
/** @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */
29-
protected $requestMock;
34+
/** @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject */
35+
private $requestMock;
3036

31-
/** @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject */
32-
protected $responseMock;
37+
/** @var ResponseInterface|\PHPUnit_Framework_MockObject_MockObject */
38+
private $responseMock;
3339

3440
protected function setUp()
3541
{
36-
$this->sidebarMock = $this->createMock(\Magento\Checkout\Model\Sidebar::class);
37-
$this->loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
38-
$this->jsonHelperMock = $this->createMock(\Magento\Framework\Json\Helper\Data::class);
39-
$this->requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class);
42+
$this->sidebarMock = $this->createMock(Sidebar::class);
43+
$this->loggerMock = $this->createMock(LoggerInterface::class);
44+
$this->jsonHelperMock = $this->createMock(Data::class);
45+
$this->requestMock = $this->createMock(RequestInterface::class);
4046
$this->responseMock = $this->getMockForAbstractClass(
41-
\Magento\Framework\App\ResponseInterface::class,
47+
ResponseInterface::class,
4248
[],
4349
'',
4450
false,
@@ -49,7 +55,7 @@ protected function setUp()
4955

5056
$this->objectManagerHelper = new ObjectManagerHelper($this);
5157
$this->updateItemQty = $this->objectManagerHelper->getObject(
52-
\Magento\Checkout\Controller\Sidebar\UpdateItemQty::class,
58+
UpdateItemQty::class,
5359
[
5460
'sidebar' => $this->sidebarMock,
5561
'logger' => $this->loggerMock,
@@ -60,6 +66,9 @@ protected function setUp()
6066
);
6167
}
6268

69+
/**
70+
* Tests execute action.
71+
*/
6372
public function testExecute()
6473
{
6574
$this->requestMock->expects($this->at(0))
@@ -113,6 +122,9 @@ public function testExecute()
113122
$this->assertEquals('json represented', $this->updateItemQty->execute());
114123
}
115124

125+
/**
126+
* Tests with localized exception.
127+
*/
116128
public function testExecuteWithLocalizedException()
117129
{
118130
$this->requestMock->expects($this->at(0))
@@ -157,6 +169,9 @@ public function testExecuteWithLocalizedException()
157169
$this->assertEquals('json represented', $this->updateItemQty->execute());
158170
}
159171

172+
/**
173+
* Tests with exception.
174+
*/
160175
public function testExecuteWithException()
161176
{
162177
$this->requestMock->expects($this->at(0))
@@ -207,4 +222,31 @@ public function testExecuteWithException()
207222

208223
$this->assertEquals('json represented', $this->updateItemQty->execute());
209224
}
225+
226+
/**
227+
* Tests execute with float item quantity.
228+
*/
229+
public function testExecuteWithFloatItemQty()
230+
{
231+
$itemId = '1';
232+
$floatItemQty = '2.2';
233+
234+
$this->requestMock->expects($this->at(0))
235+
->method('getParam')
236+
->with('item_id', null)
237+
->willReturn($itemId);
238+
$this->requestMock->expects($this->at(1))
239+
->method('getParam')
240+
->with('item_qty', null)
241+
->willReturn($floatItemQty);
242+
243+
$this->sidebarMock->expects($this->once())
244+
->method('checkQuoteItem')
245+
->with($itemId);
246+
$this->sidebarMock->expects($this->once())
247+
->method('updateQuoteItem')
248+
->with($itemId, $floatItemQty);
249+
250+
$this->updateItemQty->execute();
251+
}
210252
}

app/code/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Downloadable.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Magento\Downloadable\Api\Data\SampleInterfaceFactory;
1212
use Magento\Downloadable\Api\Data\LinkInterfaceFactory;
1313

14+
/**
15+
* Class for initialization downloadable info from request.
16+
*/
1417
class Downloadable
1518
{
1619
/**
@@ -92,6 +95,8 @@ public function afterInitialize(
9295
}
9396
}
9497
$extension->setDownloadableProductLinks($links);
98+
} else {
99+
$extension->setDownloadableProductLinks([]);
95100
}
96101
if (isset($downloadable['sample']) && is_array($downloadable['sample'])) {
97102
$samples = [];
@@ -107,6 +112,8 @@ public function afterInitialize(
107112
}
108113
}
109114
$extension->setDownloadableProductSamples($samples);
115+
} else {
116+
$extension->setDownloadableProductSamples([]);
110117
}
111118
$product->setExtensionAttributes($extension);
112119
if ($product->getLinksPurchasedSeparately()) {

app/code/Magento/Paypal/Model/Payflowpro.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
419419
$request->setTrxtype(self::TRXTYPE_SALE);
420420
$request->setOrigid($payment->getAdditionalInformation(self::PNREF));
421421
$payment->unsAdditionalInformation(self::PNREF);
422+
$request->setData('currency', $payment->getOrder()->getBaseCurrencyCode());
422423
} elseif ($payment->getParentTransactionId()) {
423424
$request = $this->buildBasicRequest();
424425
$request->setOrigid($payment->getParentTransactionId());

app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@
187187
display: block;
188188
}
189189

190-
// External link marker
190+
// External link marker
191191
[target='_blank'] {
192192
&:after {
193193
&:extend(.abs-icon all);
194194
content: @icon-external-link__content;
195-
font-size: 0.5rem;
195+
font-size: .5rem;
196196
margin-left: @indent__xs;
197197
vertical-align: super;
198198
}
@@ -271,9 +271,17 @@
271271

272272
&._show {
273273
> .submenu {
274+
display: block;
275+
float: left;
276+
left: 100%;
277+
max-width: 1640px;
278+
min-height: 98.65%;
279+
min-width: 100%;
280+
overflow-x: scroll;
281+
position: absolute;
274282
transform: translateX(0);
275283
visibility: visible;
276-
z-index: @submenu__z-index;
284+
z-index: 698;
277285
}
278286
}
279287
}

app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@
6060

6161
.abs-field-no-label {
6262
/**
63-
* @codingStandardsIgnoreStart
63+
*@codingStandardsIgnoreStart
6464
*/
6565
#mix-grid .return_length(@field-label-grid__column, @field-grid__columns, '+');
66-
//@codingStandardsIgnoreEnd
6766
margin-left: @_length;
67+
//@codingStandardsIgnoreEnd
6868
}
6969

7070
//
@@ -170,13 +170,6 @@
170170
.admin__control-text,
171171
.admin__control-textarea {
172172
width: 100%;
173-
&.disabled {
174-
background-color: #e9e9e9;
175-
border-color: #adadad;
176-
color: #303030;
177-
cursor: not-allowed;
178-
opacity: .5;
179-
}
180173
}
181174
}
182175

@@ -194,13 +187,10 @@
194187

195188
.admin__field-label {
196189
color: @field-label__color;
190+
cursor: pointer;
197191
margin: 0;
198192
text-align: right;
199193

200-
label {
201-
cursor: pointer;
202-
}
203-
204194
+ br {
205195
display: none;
206196
}
@@ -296,6 +286,14 @@
296286
opacity: 1;
297287
}
298288
}
289+
290+
legend.admin__field-label {
291+
span {
292+
&:after {
293+
display: none;
294+
}
295+
}
296+
}
299297

300298
// ToDo UI: Scope Labels must be moved from right side of each control to the place under the label of the control.
301299
// This code must be removed after Scope Labels are moved completely.
@@ -307,7 +305,11 @@
307305
content: attr(data-config-scope);
308306
display: inline-block;
309307
font-size: @font-size__s;
308+
/**
309+
*@codingStandardsIgnoreStart
310+
*/
310311
left: @_length;
312+
//@codingStandardsIgnoreEnd
311313
line-height: 3.2rem;
312314
margin-left: 2 * @temp_gutter;
313315
position: absolute;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Catalog\Api\ProductRepositoryInterface;
8+
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Model\Product\Attribute\Source\Status;
10+
use Magento\Catalog\Model\Product\Type;
11+
use Magento\Catalog\Model\Product\Visibility;
12+
use Magento\CatalogInventory\Api\Data\StockItemInterface;
13+
use Magento\TestFramework\Helper\Bootstrap;
14+
use Magento\TestFramework\ObjectManager;
15+
16+
/** @var ObjectManager $objectManager */
17+
$objectManager = Bootstrap::getObjectManager();
18+
19+
/** @var Product $product */
20+
$product = $objectManager->create(Product::class);
21+
$product->isObjectNew(true);
22+
$product->setTypeId(Type::TYPE_SIMPLE)
23+
->setAttributeSetId(4)
24+
->setWebsiteIds([1])
25+
->setName('Simple Product Decimal Qty')
26+
->setSku('simple_with_decimal_qty')
27+
->setPrice(10)
28+
->setWeight(1)
29+
->setVisibility(Visibility::VISIBILITY_BOTH)
30+
->setStatus(Status::STATUS_ENABLED);
31+
32+
/** @var StockItemInterface $stockItem */
33+
$stockItem = $objectManager->create(StockItemInterface::class);
34+
$stockItem->setIsInStock(true)
35+
->setQty(10000)
36+
->setIsQtyDecimal(true)
37+
->setUseConfigMinSaleQty(false)
38+
->setMinSaleQty(1.1)
39+
->setUseConfigEnableQtyInc(false)
40+
->setEnableQtyIncrements(true)
41+
->setUseConfigQtyIncrements(false)
42+
->setQtyIncrements(1.1);
43+
44+
$extensionAttributes = $product->getExtensionAttributes();
45+
$extensionAttributes->setStockItem($stockItem);
46+
47+
/** @var ProductRepositoryInterface $productRepository */
48+
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
49+
$product = $productRepository->save($product);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Catalog\Api\ProductRepositoryInterface;
8+
use Magento\TestFramework\Helper\Bootstrap;
9+
use Magento\TestFramework\ObjectManager;
10+
11+
/** @var ObjectManager $objectManager */
12+
$objectManager = Bootstrap::getObjectManager();
13+
14+
/** @var ProductRepositoryInterface $productRepository */
15+
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
16+
$productRepository->deleteById('simple_with_decimal_qty');

0 commit comments

Comments
 (0)