Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit a5ac4dd

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into reece-pr
2 parents 9cd11c6 + da1a96c commit a5ac4dd

File tree

30 files changed

+264
-85
lines changed

30 files changed

+264
-85
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public function testGetWithNonExistingProduct()
266266

267267
/**
268268
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
269-
* @expectedExceptionText The image doesn't exist. Verify and try again.
269+
* @expectedExceptionMessage The image doesn't exist. Verify and try again.
270270
*/
271271
public function testGetWithNonExistingImage()
272272
{

app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function setUp()
5454

5555
/**
5656
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
57-
* @expectedMessage Tier price is unavailable for this product.
57+
* @expectedExceptionMessage Product hasn't group price with such data: customerGroupId = '1', website = 1, qty = 3
5858
*/
5959
public function testRemoveWhenTierPricesNotExists()
6060
{
@@ -70,7 +70,7 @@ public function testRemoveWhenTierPricesNotExists()
7070

7171
/**
7272
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
73-
* @expectedMessage For current customerGroupId = '10' with 'qty' = 15 any tier price exist'.
73+
* @expectedExceptionMessage Product hasn't group price with such data: customerGroupId = '10', website = 1, qty = 5
7474
*/
7575
public function testRemoveTierPriceForNonExistingCustomerGroup()
7676
{
@@ -81,7 +81,7 @@ public function testRemoveTierPriceForNonExistingCustomerGroup()
8181
->will($this->returnValue($this->prices));
8282
$this->productMock->expects($this->never())->method('setData');
8383
$this->productRepositoryMock->expects($this->never())->method('save');
84-
$this->priceModifier->removeTierPrice($this->productMock, 10, 15, 1);
84+
$this->priceModifier->removeTierPrice($this->productMock, 10, 5, 1);
8585
}
8686

8787
public function testSuccessfullyRemoveTierPriceSpecifiedForAllGroups()

app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function testSuccessDeleteTierPrice()
195195

196196
/**
197197
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
198-
* @message The product doesn't exist. Verify and try again.
198+
* @expectedExceptionMessage No such entity.
199199
*/
200200
public function testDeleteTierPriceFromNonExistingProduct()
201201
{

app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Magento\Framework\App\Request\DataPersistorInterface;
1515

1616
/**
17+
* Save action for catalog rule
18+
*
1719
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1820
*/
1921
class Save extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog implements HttpPostActionInterface
@@ -40,7 +42,9 @@ public function __construct(
4042
}
4143

4244
/**
43-
* @return void
45+
* Execute save action from catalog rule
46+
*
47+
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|void
4448
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
4549
*/
4650
public function execute()
@@ -61,6 +65,17 @@ public function execute()
6165
['request' => $this->getRequest()]
6266
);
6367
$data = $this->getRequest()->getPostValue();
68+
69+
$filterValues = ['from_date' => $this->_dateFilter];
70+
if ($this->getRequest()->getParam('to_date')) {
71+
$filterValues['to_date'] = $this->_dateFilter;
72+
}
73+
$inputFilter = new \Zend_Filter_Input(
74+
$filterValues,
75+
[],
76+
$data
77+
);
78+
$data = $inputFilter->getUnescaped();
6479
$id = $this->getRequest()->getParam('rule_id');
6580
if ($id) {
6681
$model = $ruleRepository->get($id);

app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testCheckQuoteItem()
9898

9999
/**
100100
* @expectedException \Magento\Framework\Exception\LocalizedException
101-
* @exceptedExceptionMessage The quote item isn't found. Verify the item and try again.
101+
* @expectedExceptionMessage The quote item isn't found. Verify the item and try again.
102102
*/
103103
public function testCheckQuoteItemWithException()
104104
{

app/code/Magento/Checkout/view/frontend/web/js/model/cart/estimate-service.js

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,71 @@ define([
1414
'use strict';
1515

1616
var rateProcessors = [],
17-
totalsProcessors = [];
17+
totalsProcessors = [],
1818

19-
quote.shippingAddress.subscribe(function () {
20-
var type = quote.shippingAddress().getType();
19+
/**
20+
* Estimate totals for shipping address and update shipping rates.
21+
*/
22+
estimateTotalsAndUpdateRates = function () {
23+
var type = quote.shippingAddress().getType();
2124

22-
if (
23-
quote.isVirtual() ||
24-
window.checkoutConfig.activeCarriers && window.checkoutConfig.activeCarriers.length === 0
25-
) {
26-
// update totals block when estimated address was set
27-
totalsProcessors['default'] = totalsDefaultProvider;
28-
totalsProcessors[type] ?
29-
totalsProcessors[type].estimateTotals(quote.shippingAddress()) :
30-
totalsProcessors['default'].estimateTotals(quote.shippingAddress());
31-
} else {
32-
// check if user data not changed -> load rates from cache
33-
if (!cartCache.isChanged('address', quote.shippingAddress()) &&
34-
!cartCache.isChanged('cartVersion', customerData.get('cart')()['data_id']) &&
35-
cartCache.get('rates')
25+
if (
26+
quote.isVirtual() ||
27+
window.checkoutConfig.activeCarriers && window.checkoutConfig.activeCarriers.length === 0
3628
) {
37-
shippingService.setShippingRates(cartCache.get('rates'));
29+
// update totals block when estimated address was set
30+
totalsProcessors['default'] = totalsDefaultProvider;
31+
totalsProcessors[type] ?
32+
totalsProcessors[type].estimateTotals(quote.shippingAddress()) :
33+
totalsProcessors['default'].estimateTotals(quote.shippingAddress());
34+
} else {
35+
// check if user data not changed -> load rates from cache
36+
if (!cartCache.isChanged('address', quote.shippingAddress()) &&
37+
!cartCache.isChanged('cartVersion', customerData.get('cart')()['data_id']) &&
38+
cartCache.get('rates')
39+
) {
40+
shippingService.setShippingRates(cartCache.get('rates'));
3841

39-
return;
42+
return;
43+
}
44+
45+
// update rates list when estimated address was set
46+
rateProcessors['default'] = defaultProcessor;
47+
rateProcessors[type] ?
48+
rateProcessors[type].getRates(quote.shippingAddress()) :
49+
rateProcessors['default'].getRates(quote.shippingAddress());
50+
51+
// save rates to cache after load
52+
shippingService.getShippingRates().subscribe(function (rates) {
53+
cartCache.set('rates', rates);
54+
});
4055
}
56+
},
4157

42-
// update rates list when estimated address was set
43-
rateProcessors['default'] = defaultProcessor;
44-
rateProcessors[type] ?
45-
rateProcessors[type].getRates(quote.shippingAddress()) :
46-
rateProcessors['default'].getRates(quote.shippingAddress());
58+
/**
59+
* Estimate totals for shipping address.
60+
*/
61+
estimateTotalsShipping = function () {
62+
totalsDefaultProvider.estimateTotals(quote.shippingAddress());
63+
},
4764

48-
// save rates to cache after load
49-
shippingService.getShippingRates().subscribe(function (rates) {
50-
cartCache.set('rates', rates);
51-
});
52-
}
53-
});
54-
quote.shippingMethod.subscribe(function () {
55-
totalsDefaultProvider.estimateTotals(quote.shippingAddress());
56-
});
57-
quote.billingAddress.subscribe(function () {
58-
var type = quote.billingAddress().getType();
65+
/**
66+
* Estimate totals for billing address.
67+
*/
68+
estimateTotalsBilling = function () {
69+
var type = quote.billingAddress().getType();
70+
71+
if (quote.isVirtual()) {
72+
// update totals block when estimated address was set
73+
totalsProcessors['default'] = totalsDefaultProvider;
74+
totalsProcessors[type] ?
75+
totalsProcessors[type].estimateTotals(quote.billingAddress()) :
76+
totalsProcessors['default'].estimateTotals(quote.billingAddress());
77+
}
78+
};
5979

60-
if (quote.isVirtual()) {
61-
// update totals block when estimated address was set
62-
totalsProcessors['default'] = totalsDefaultProvider;
63-
totalsProcessors[type] ?
64-
totalsProcessors[type].estimateTotals(quote.billingAddress()) :
65-
totalsProcessors['default'].estimateTotals(quote.billingAddress());
66-
}
67-
});
80+
quote.shippingAddress.subscribe(estimateTotalsAndUpdateRates);
81+
quote.shippingMethod.subscribe(estimateTotalsShipping);
82+
quote.billingAddress.subscribe(estimateTotalsBilling);
83+
customerData.get('cart').subscribe(estimateTotalsShipping);
6884
});
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Directory\Setup\Patch\Data;
10+
11+
use Magento\Directory\Setup\DataInstaller;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
use Magento\Framework\Setup\Patch\PatchVersionInterface;
15+
16+
/**
17+
* Adds Australian States
18+
*/
19+
class AddDataForAustralia implements DataPatchInterface, PatchVersionInterface
20+
{
21+
/**
22+
* @var ModuleDataSetupInterface
23+
*/
24+
private $moduleDataSetup;
25+
26+
/**
27+
* @var \Magento\Directory\Setup\DataInstallerFactory
28+
*/
29+
private $dataInstallerFactory;
30+
31+
/**
32+
* @param ModuleDataSetupInterface $moduleDataSetup
33+
* @param \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
34+
*/
35+
public function __construct(
36+
ModuleDataSetupInterface $moduleDataSetup,
37+
\Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory
38+
) {
39+
$this->moduleDataSetup = $moduleDataSetup;
40+
$this->dataInstallerFactory = $dataInstallerFactory;
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public function apply()
47+
{
48+
/** @var DataInstaller $dataInstaller */
49+
$dataInstaller = $this->dataInstallerFactory->create();
50+
$dataInstaller->addCountryRegions(
51+
$this->moduleDataSetup->getConnection(),
52+
$this->getDataForAustralia()
53+
);
54+
}
55+
56+
/**
57+
* Australian states data.
58+
*
59+
* @return array
60+
*/
61+
private function getDataForAustralia()
62+
{
63+
return [
64+
['AU', 'ACT', 'Australian Capital Territory'],
65+
['AU', 'NSW', 'New South Wales'],
66+
['AU', 'VIC', 'Victoria'],
67+
['AU', 'QLD', 'Queensland'],
68+
['AU', 'SA', 'South Australia'],
69+
['AU', 'TAS', 'Tasmania'],
70+
['AU', 'WA', 'Western Australia'],
71+
['AU', 'NT', 'Northern Territory']
72+
];
73+
}
74+
75+
/**
76+
* @inheritdoc
77+
*/
78+
public static function getDependencies()
79+
{
80+
return [
81+
InitializeDirectoryData::class,
82+
AddDataForCroatia::class,
83+
AddDataForIndia::class,
84+
];
85+
}
86+
87+
/**
88+
* @inheritdoc
89+
*/
90+
public static function getVersion()
91+
{
92+
return '2.0.3';
93+
}
94+
95+
/**
96+
* @inheritdoc
97+
*/
98+
public function getAliases()
99+
{
100+
return [];
101+
}
102+
}

app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testSetResourceInvalidPath()
8989

9090
/**
9191
* @expectedException \Magento\Framework\Exception\LocalizedException
92-
* @exectedExceptionMessage Please set resource file and link type.
92+
* @expectedExceptionMessage Please set resource file and link type.
9393
*/
9494
public function testGetFileSizeNoResource()
9595
{

app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function testAfterSaveGiftMessages()
128128

129129
/**
130130
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
131-
* @expectedMessage The gift message couldn't be added to the "Test message" order.
131+
* @expectedExceptionMessage The gift message couldn't be added to the "Test message" order.
132132
*/
133133
public function testAfterSaveIfGiftMessagesNotExist()
134134
{
@@ -146,7 +146,7 @@ public function testAfterSaveIfGiftMessagesNotExist()
146146
$this->giftMessageOrderRepositoryMock
147147
->expects($this->once())
148148
->method('save')
149-
->willThrowException(new \Exception('TestMessage'));
149+
->willThrowException(new \Exception('Test message'));
150150

151151
// save Gift Messages on item level
152152
$this->orderMock->expects($this->never())->method('getItems');
@@ -155,7 +155,7 @@ public function testAfterSaveIfGiftMessagesNotExist()
155155

156156
/**
157157
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
158-
* @expectedMessage The gift message couldn't be added to the "Test message" order.
158+
* @expectedExceptionMessage The gift message couldn't be added to the "Test message" order item.
159159
*/
160160
public function testAfterSaveIfItemGiftMessagesNotExist()
161161
{
@@ -185,7 +185,7 @@ public function testAfterSaveIfItemGiftMessagesNotExist()
185185
$this->giftMessageOrderItemRepositoryMock
186186
->expects($this->once())->method('save')
187187
->with($orderId, $orderItemId, $this->giftMessageMock)
188-
->willThrowException(new \Exception('TestMessage'));
188+
->willThrowException(new \Exception('Test message'));
189189
$this->plugin->afterSave($this->orderRepositoryMock, $this->orderMock);
190190
}
191191
}

app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function setUp()
3636

3737
/**
3838
* @expectedException \Magento\Framework\Exception\StateException
39-
* @expectedMessage You don't have the correct permissions to assign the customer to the cart.
39+
* @expectedExceptionMessage You don't have the correct permissions to assign the customer to the cart.
4040
*/
4141
public function testBeforeAssignCustomer()
4242
{

app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function setUp()
9292

9393
/**
9494
* @expectedException \InvalidArgumentException
95-
* @ExceptedExceptionMessage The qty value is required to update quote item.
95+
* @expectedExceptionMessage The qty value is required to update quote item.
9696
*/
9797
public function testUpdateNoQty()
9898
{

app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected function setUp()
102102

103103
/**
104104
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
105-
* @expected ExceptionMessage error345
105+
* @expectedExceptionMessage error345
106106
*/
107107
public function testSetAddressValidationFailed()
108108
{

0 commit comments

Comments
 (0)