Skip to content

Commit d946801

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-94299' into 2.2-develop-pr64
2 parents 7fecefc + 6743308 commit d946801

File tree

24 files changed

+218
-74
lines changed

24 files changed

+218
-74
lines changed

app/code/Magento/Authorizenet/view/adminhtml/templates/order/view/info/fraud_details.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ $fraudDetails = $payment->getAdditionalInformation('fraud_details');
4444
<?php endif; ?>
4545

4646
<?php if(!empty($fraudDetails['fraud_filters'])): ?>
47-
<b><?= $block->escapeHtml(__('Fraud Filters')) ?>:
48-
</b></br>
47+
<strong><?= $block->escapeHtml(__('Fraud Filters')) ?>:
48+
</strong></br>
4949
<?php foreach($fraudDetails['fraud_filters'] as $filter): ?>
5050
<?= $block->escapeHtml($filter['name']) ?>:
5151
<?= $block->escapeHtml($filter['action']) ?>

app/code/Magento/Catalog/view/adminhtml/web/catalog/category/edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ define([
8282
return function (config, element) {
8383
config = config || {};
8484
jQuery(element).on('click', function () {
85-
categorySubmit(config.url, config.ajax);
85+
categorySubmit();
8686
});
8787
};
8888
});

app/code/Magento/CatalogInventory/Model/Stock/StockItemRepository.php

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ public function save(StockItemInterface $stockItem)
161161
$typeId = $product->getTypeId() ?: $product->getTypeInstance()->getTypeId();
162162
$isQty = $this->stockConfiguration->isQty($typeId);
163163
if ($isQty) {
164-
$this->changeIsInStockIfNecessary($stockItem);
164+
$isInStock = $this->stockStateProvider->verifyStock($stockItem);
165+
if ($stockItem->getManageStock() && !$isInStock) {
166+
$stockItem->setIsInStock(false)->setStockStatusChangedAutomaticallyFlag(true);
167+
}
165168
// if qty is below notify qty, update the low stock date to today date otherwise set null
166169
$stockItem->setLowStockDate(null);
167170
if ($this->stockStateProvider->verifyNotification($stockItem)) {
@@ -257,29 +260,4 @@ private function getStockRegistryStorage()
257260
}
258261
return $this->stockRegistryStorage;
259262
}
260-
261-
/**
262-
* Change is_in_stock value if necessary.
263-
*
264-
* @param StockItemInterface $stockItem
265-
*
266-
* @return void
267-
*/
268-
private function changeIsInStockIfNecessary(StockItemInterface $stockItem)
269-
{
270-
$isInStock = $this->stockStateProvider->verifyStock($stockItem);
271-
if ($stockItem->getManageStock() && !$isInStock) {
272-
$stockItem->setIsInStock(false)->setStockStatusChangedAutomaticallyFlag(true);
273-
}
274-
275-
if ($stockItem->getManageStock()
276-
&& $isInStock
277-
&& !$stockItem->getIsInStock()
278-
&& $stockItem->getQty() > 0
279-
&& $stockItem->getOrigData(\Magento\CatalogInventory\Api\Data\StockItemInterface::QTY) <= 0
280-
&& $stockItem->getOrigData(\Magento\CatalogInventory\Api\Data\StockItemInterface::QTY) !== null
281-
) {
282-
$stockItem->setIsInStock(true)->setStockStatusChangedAutomaticallyFlag(true);
283-
}
284-
}
285263
}

app/code/Magento/CatalogInventory/Model/StockRegistry.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@ public function updateStockItemBySku($productSku, \Magento\CatalogInventory\Api\
171171
$productId = $this->resolveProductId($productSku);
172172
$websiteId = $stockItem->getWebsiteId() ?: null;
173173
$origStockItem = $this->getStockItem($productId, $websiteId);
174+
175+
if ($stockItem->getManageStock()
176+
&& !$stockItem->getIsInStock()
177+
&& $stockItem->getQty() > 0
178+
&& $stockItem->getOrigData(\Magento\CatalogInventory\Api\Data\StockItemInterface::QTY) <= 0
179+
&& $stockItem->getOrigData(\Magento\CatalogInventory\Api\Data\StockItemInterface::QTY) !== null
180+
) {
181+
$stockItem->setIsInStock(true)->setStockStatusChangedAutomaticallyFlag(true);
182+
}
183+
174184
$data = $stockItem->getData();
175185
if ($origStockItem->getItemId()) {
176186
unset($data['item_id']);

app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/StockItemRepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function testSave()
276276
->method('verifyStock')
277277
->with($this->stockItemMock)
278278
->willReturn(false);
279-
$this->stockItemMock->expects($this->exactly(2))->method('getManageStock')->willReturn(true);
279+
$this->stockItemMock->expects($this->once())->method('getManageStock')->willReturn(true);
280280
$this->stockItemMock->expects($this->once())->method('setIsInStock')->with(false)->willReturnSelf();
281281
$this->stockItemMock->expects($this->once())
282282
->method('setStockStatusChangedAutomaticallyFlag')

app/code/Magento/CatalogInventory/Test/Unit/Model/StockRegistryTest.php

Lines changed: 158 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\CatalogInventory\Test\Unit\Model;
77

8+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
9+
810
/**
911
* Class StockRegistryTest
1012
*/
@@ -16,37 +18,188 @@ class StockRegistryTest extends \PHPUnit\Framework\TestCase
1618
protected $model;
1719

1820
/**
19-
* @var \PHPUnit_Framework_MockObject_MockObject
21+
* @var \Magento\CatalogInventory\Api\StockItemCriteriaInterface|MockObject
2022
*/
2123
protected $criteria;
2224

25+
/**
26+
* @var \Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory|MockObject
27+
*/
28+
private $criteriaFactory;
29+
30+
/**
31+
* @var \Magento\CatalogInventory\Api\Data\StockItemInterface|MockObject
32+
*/
33+
private $stockItemMock;
34+
35+
/**
36+
* @var \Magento\CatalogInventory\Api\StockConfigurationInterface|MockObject
37+
*/
38+
private $stockConfigurationMock;
39+
40+
/**
41+
* @var \Magento\CatalogInventory\Api\StockItemRepositoryInterface|MockObject
42+
*/
43+
private $stockItemRepositoryMock;
44+
45+
/**
46+
* @var \Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface|MockObject
47+
*/
48+
private $stockRegistryProviderMock;
49+
50+
/**
51+
* @var \Magento\Catalog\Model\ProductFactory|MockObject
52+
*/
53+
private $productFactoryMock;
54+
2355
protected function setUp()
2456
{
2557
$this->criteria = $this->getMockBuilder(\Magento\CatalogInventory\Api\StockItemCriteriaInterface::class)
2658
->disableOriginalConstructor()
2759
->getMock();
2860

29-
$criteriaFactory = $this->getMockBuilder(\Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory::class)
30-
->setMethods(['create'])
61+
$this->criteriaFactory = $this->getMockBuilder(
62+
\Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory::class
63+
)->setMethods(['create'])
3164
->disableOriginalConstructor()
3265
->getMock();
33-
$criteriaFactory->expects($this->once())->method('create')->willReturn($this->criteria);
66+
67+
$this->stockItemMock = $this->getMockBuilder(\Magento\CatalogInventory\Api\Data\StockItemInterface::class)
68+
->disableOriginalConstructor()
69+
->setMethods([
70+
'getWebsiteId',
71+
'getData',
72+
'addData',
73+
'getManageStock',
74+
'getIsInStock',
75+
'getQty',
76+
'getOrigData',
77+
'setIsInStock',
78+
'setStockStatusChangedAutomaticallyFlag',
79+
])
80+
->getMockForAbstractClass();
81+
82+
$this->stockConfigurationMock = $this->createMock(
83+
\Magento\CatalogInventory\Api\StockConfigurationInterface::class
84+
);
85+
$this->stockRegistryProviderMock = $this->createMock(
86+
\Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface::class
87+
);
88+
$this->stockItemRepositoryMock = $this->createMock(
89+
\Magento\CatalogInventory\Api\StockItemRepositoryInterface::class
90+
);
91+
$this->productFactoryMock = $this->createPartialMock(\Magento\Catalog\Model\ProductFactory::class, ['create']);
3492

3593
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
3694
$this->model = $objectManager->getObject(
3795
\Magento\CatalogInventory\Model\StockRegistry::class,
3896
[
39-
'criteriaFactory' => $criteriaFactory
97+
'stockConfiguration' => $this->stockConfigurationMock,
98+
'stockRegistryProvider' => $this->stockRegistryProviderMock,
99+
'stockItemRepository' => $this->stockItemRepositoryMock,
100+
'criteriaFactory' => $this->criteriaFactory,
101+
'productFactory' => $this->productFactoryMock,
40102
]
41103
);
42104
}
43105

44106
public function testGetLowStockItems()
45107
{
108+
$this->criteriaFactory->expects($this->once())->method('create')->willReturn($this->criteria);
46109
$this->criteria->expects($this->once())->method('setLimit')->with(1, 0);
47110
$this->criteria->expects($this->once())->method('setScopeFilter')->with(1);
48111
$this->criteria->expects($this->once())->method('setQtyFilter')->with('<=');
49112
$this->criteria->expects($this->once())->method('addField')->with('qty');
50113
$this->model->getLowStockItems(1, 100);
51114
}
115+
116+
/**
117+
* @return void
118+
*/
119+
public function testUpdateStockItemBySku()
120+
{
121+
$manageStock = 1;
122+
$isInStock = 0;
123+
$qty = 10;
124+
$origQty = 0;
125+
126+
$this->stockItemMock->expects($this->once())->method('getManageStock')->willReturn($manageStock);
127+
$this->stockItemMock->expects($this->once())->method('getIsInStock')->willReturn($isInStock);
128+
$this->stockItemMock->expects($this->once())->method('getQty')->willReturn($qty);
129+
$this->stockItemMock->expects($this->exactly(2))
130+
->method('getOrigData')
131+
->with(\Magento\CatalogInventory\Api\Data\StockItemInterface::QTY)
132+
->willReturn($origQty);
133+
134+
$this->stockItemMock->expects($this->once())->method('setIsInStock')->with(true)->willReturnSelf();
135+
$this->stockItemMock->expects($this->once())
136+
->method('setStockStatusChangedAutomaticallyFlag')
137+
->with(true)
138+
->willReturnSelf();
139+
140+
$this->configureAndCallUpdateStockItemBySku();
141+
}
142+
143+
/**
144+
* @return void
145+
*/
146+
public function testUpdateStockItemBySkuWithoutUpdateStockStatus()
147+
{
148+
$manageStock = 0;
149+
150+
$this->stockItemMock->expects($this->once())->method('getManageStock')->willReturn($manageStock);
151+
$this->stockItemMock->expects($this->never())->method('getIsInStock');
152+
$this->stockItemMock->expects($this->never())->method('getQty');
153+
$this->stockItemMock->expects($this->never())
154+
->method('getOrigData')
155+
->with(\Magento\CatalogInventory\Api\Data\StockItemInterface::QTY);
156+
157+
$this->stockItemMock->expects($this->never())->method('setIsInStock')->with(true);
158+
$this->stockItemMock->expects($this->never())->method('setStockStatusChangedAutomaticallyFlag')->with(true);
159+
160+
$this->configureAndCallUpdateStockItemBySku();
161+
}
162+
163+
/**
164+
* @return void
165+
*/
166+
private function configureAndCallUpdateStockItemBySku()
167+
{
168+
$productId = 1;
169+
$productSku = 'Simple';
170+
$websiteId = 0;
171+
$scopeId = 1;
172+
$data = ['item_id' => 1, 'is_in_stock' => 1];
173+
174+
/** @var \Magento\CatalogInventory\Api\Data\StockItemInterface|MockObject $origStockItemMock */
175+
$origStockItemMock = $this->getMockBuilder(\Magento\CatalogInventory\Api\Data\StockItemInterface::class)
176+
->disableOriginalConstructor()
177+
->setMethods(['getItemId', 'addData', 'setProductId'])
178+
->getMockForAbstractClass();
179+
180+
/** @var \Magento\Catalog\Model\Product|MockObject $productMock */
181+
$productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, ['getIdBySku']);
182+
$this->productFactoryMock->expects($this->once())->method('create')->willReturn($productMock);
183+
$productMock->expects($this->once())->method('getIdBySku')->with($productSku)->willReturn($productId);
184+
185+
$this->stockItemMock->expects($this->once())->method('getWebsiteId')->willReturn($websiteId);
186+
$this->stockItemMock->expects($this->once())->method('getData')->willReturn($data);
187+
188+
$origStockItemMock->expects($this->exactly(2))->method('getItemId')->willReturn(null);
189+
$origStockItemMock->expects($this->once())->method('addData')->with($data)->willReturnSelf();
190+
$origStockItemMock->expects($this->once())->method('setProductId')->with($productId)->willReturnSelf();
191+
192+
$this->stockConfigurationMock->expects($this->once())->method('getDefaultScopeId')->willReturn($scopeId);
193+
$this->stockRegistryProviderMock->expects($this->once())
194+
->method('getStockItem')
195+
->with($productId, $scopeId)
196+
->willReturn($origStockItemMock);
197+
198+
$this->stockItemRepositoryMock->expects($this->once())
199+
->method('save')
200+
->with($origStockItemMock)
201+
->willReturn($origStockItemMock);
202+
203+
$this->model->updateStockItemBySku($productSku, $this->stockItemMock);
204+
}
52205
}

app/code/Magento/Checkout/view/adminhtml/email/failed_payment.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,43 @@ <h1>{{trans "Payment Transaction Failed"}}</h1>
2323

2424
<ul>
2525
<li>
26-
<b>{{trans "Reason"}}</b><br />
26+
<strong>{{trans "Reason"}}</strong><br />
2727
{{var reason}}
2828
</li>
2929
<li>
30-
<b>{{trans "Checkout Type"}}</b><br />
30+
<strong>{{trans "Checkout Type"}}</strong><br />
3131
{{var checkoutType}}
3232
</li>
3333
<li>
34-
<b>{{trans "Customer:"}}</b><br />
34+
<strong>{{trans "Customer:"}}</strong><br />
3535
<a href="mailto:{{var customerEmail}}">{{var customer}}</a> &lt;{{var customerEmail}}&gt;
3636
</li>
3737
<li>
38-
<b>{{trans "Items"}}</b><br />
38+
<strong>{{trans "Items"}}</strong><br />
3939
{{var items|raw}}
4040
</li>
4141
<li>
42-
<b>{{trans "Total:"}}</b><br />
42+
<strong>{{trans "Total:"}}</strong><br />
4343
{{var total}}
4444
</li>
4545
<li>
46-
<b>{{trans "Billing Address:"}}</b><br />
46+
<strong>{{trans "Billing Address:"}}</strong><br />
4747
{{var billingAddress.format('html')|raw}}
4848
</li>
4949
<li>
50-
<b>{{trans "Shipping Address:"}}</b><br />
50+
<strong>{{trans "Shipping Address:"}}</strong><br />
5151
{{var shippingAddress.format('html')|raw}}
5252
</li>
5353
<li>
54-
<b>{{trans "Shipping Method:"}}</b><br />
54+
<strong>{{trans "Shipping Method:"}}</strong><br />
5555
{{var shippingMethod}}
5656
</li>
5757
<li>
58-
<b>{{trans "Payment Method:"}}</b><br />
58+
<strong>{{trans "Payment Method:"}}</strong><br />
5959
{{var paymentMethod}}
6060
</li>
6161
<li>
62-
<b>{{trans "Date & Time:"}}</b><br />
62+
<strong>{{trans "Date & Time:"}}</strong><br />
6363
{{var dateAndTime}}
6464
</li>
6565
</ul>

app/code/Magento/Contact/view/frontend/email/submitted_form.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616

1717
<table class="message-details">
1818
<tr>
19-
<td><b>{{trans "Name"}}</b></td>
19+
<td><strong>{{trans "Name"}}</strong></td>
2020
<td>{{var data.name}}</td>
2121
</tr>
2222
<tr>
23-
<td><b>{{trans "Email"}}</b></td>
23+
<td><strong>{{trans "Email"}}</strong></td>
2424
<td>{{var data.email}}</td>
2525
</tr>
2626
<tr>
27-
<td><b>{{trans "Phone"}}</b></td>
27+
<td><strong>{{trans "Phone"}}</strong></td>
2828
<td>{{var data.telephone}}</td>
2929
</tr>
3030
</table>
31-
<p><b>{{trans "Message"}}</b></p>
31+
<p><strong>{{trans "Message"}}</strong></p>
3232
<p>{{var data.comment}}</p>
3333

3434
{{template config_path="design/email/footer_template"}}

app/code/Magento/CurrencySymbol/view/adminhtml/templates/system/currency/rate/matrix.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ $_rates = ($_newRates) ? $_newRates : $_oldRates;
4545
class="admin__control-text"
4646
<?= ($_currencyCode == $_rate) ? ' disabled' : '' ?> />
4747
<?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])): ?>
48-
<div class="admin__field-note"><?= /* @escapeNotVerified */ __('Old rate:') ?> <b><?= /* @escapeNotVerified */ $_oldRates[$_currencyCode][$_rate] ?></b></div>
48+
<div class="admin__field-note"><?= /* @escapeNotVerified */ __('Old rate:') ?> <strong><?= /* @escapeNotVerified */ $_oldRates[$_currencyCode][$_rate] ?></strong></div>
4949
<?php endif; ?>
5050
</td>
5151
<?php else: ?>
@@ -56,7 +56,7 @@ $_rates = ($_newRates) ? $_newRates : $_oldRates;
5656
class="admin__control-text"
5757
<?= ($_currencyCode == $_rate) ? ' disabled' : '' ?> />
5858
<?php if (isset($_newRates) && $_currencyCode != $_rate && isset($_oldRates[$_currencyCode][$_rate])): ?>
59-
<div class="admin__field-note"><?= /* @escapeNotVerified */ __('Old rate:') ?> <b><?= /* @escapeNotVerified */ $_oldRates[$_currencyCode][$_rate] ?></b></div>
59+
<div class="admin__field-note"><?= /* @escapeNotVerified */ __('Old rate:') ?> <strong><?= /* @escapeNotVerified */ $_oldRates[$_currencyCode][$_rate] ?></strong></div>
6060
<?php endif; ?>
6161
</td>
6262
<?php endif; ?>

0 commit comments

Comments
 (0)