Skip to content

Commit ea5e982

Browse files
Merge pull request #1641 from magento-engcom/2.2-develop-prs
[EngCom] Public Pull Requests - 2.2-develop - MAGETWO-82955: [Backport 2.2-develop] FIX show visual swatches in admin - product attribute #11747 - MAGETWO-82943: Magetwo 70954: Remove the component.clear from the custom options type. This causes the 'elem' array to become out of sync with the recordData #11824 - MAGETWO-82710: Fix issue #10032 - Download back-up .tgz always takes the latest that's created (2.2-develop) #11595 - MAGETWO-81994: Products added to cart with REST API give total prices equal to zero #11458 - MAGETWO-81422: #11211 Fix Store View switcher #11337
2 parents 373bd01 + 09b449b commit ea5e982

File tree

7 files changed

+61
-55
lines changed

7 files changed

+61
-55
lines changed

app/code/Magento/Backup/Model/BackupFactory.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,20 @@ public function __construct(\Magento\Framework\ObjectManagerInterface $objectMan
3939
*/
4040
public function create($timestamp, $type)
4141
{
42-
$backupId = $timestamp . '_' . $type;
4342
$fsCollection = $this->_objectManager->get(\Magento\Backup\Model\Fs\Collection::class);
4443
$backupInstance = $this->_objectManager->get(\Magento\Backup\Model\Backup::class);
44+
4545
foreach ($fsCollection as $backup) {
46-
if ($backup->getId() == $backupId) {
47-
$backupInstance->setType(
48-
$backup->getType()
49-
)->setTime(
50-
$backup->getTime()
51-
)->setName(
52-
$backup->getName()
53-
)->setPath(
54-
$backup->getPath()
55-
);
46+
if ($backup->getTime() === (int) $timestamp && $backup->getType() === $type) {
47+
$backupInstance->setData(['id' => $backup->getId()])
48+
->setType($backup->getType())
49+
->setTime($backup->getTime())
50+
->setName($backup->getName())
51+
->setPath($backup->getPath());
5652
break;
5753
}
5854
}
55+
5956
return $backupInstance;
6057
}
6158
}

app/code/Magento/Backup/Test/Unit/Model/BackupFactoryTest.php

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,29 @@ protected function setUp()
7777

7878
public function testCreate()
7979
{
80-
$this->_backupModel->expects(
81-
$this->once()
82-
)->method(
83-
'setType'
84-
)->with(
85-
$this->_data['type']
86-
)->will(
87-
$this->returnSelf()
88-
);
89-
$this->_backupModel->expects(
90-
$this->once()
91-
)->method(
92-
'setTime'
93-
)->with(
94-
$this->_data['time']
95-
)->will(
96-
$this->returnSelf()
97-
);
98-
$this->_backupModel->expects(
99-
$this->once()
100-
)->method(
101-
'setName'
102-
)->with(
103-
$this->_data['name']
104-
)->will(
105-
$this->returnSelf()
106-
);
107-
$this->_backupModel->expects(
108-
$this->once()
109-
)->method(
110-
'setPath'
111-
)->with(
112-
$this->_data['path']
113-
)->will(
114-
$this->returnSelf()
115-
);
80+
$this->_backupModel->expects($this->once())
81+
->method('setType')
82+
->with($this->_data['type'])
83+
->will($this->returnSelf());
84+
85+
$this->_backupModel->expects($this->once())
86+
->method('setTime')
87+
->with($this->_data['time'])
88+
->will($this->returnSelf());
89+
90+
$this->_backupModel->expects($this->once())
91+
->method('setName')
92+
->with($this->_data['name'])
93+
->will($this->returnSelf());
94+
95+
$this->_backupModel->expects($this->once())
96+
->method('setPath')
97+
->with($this->_data['path'])
98+
->will($this->returnSelf());
99+
100+
$this->_backupModel->expects($this->once())
101+
->method('setData')
102+
->will($this->returnSelf());
116103

117104
$this->_instance->create('1385661590', 'snapshot');
118105
}

app/code/Magento/Catalog/view/adminhtml/web/js/custom-options-type.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ define([
103103

104104
if (component) {
105105
component.visible(visible);
106-
107-
/*eslint-disable max-depth */
108-
if (_.isFunction(component.clear)) {
109-
component.clear();
110-
}
111106
}
112107
}
113108
}, this);

app/code/Magento/Quote/Model/QuoteManagement.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ public function createEmptyCart()
232232
$quote->setShippingAddress($this->quoteAddressFactory->create());
233233

234234
try {
235+
$quote->getShippingAddress()->setCollectShippingRates(true);
236+
235237
$this->quoteRepository->save($quote);
236238
} catch (\Exception $e) {
237239
throw new CouldNotSaveException(__('Cannot create quote'));

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ class QuoteManagementTest extends \PHPUnit\Framework\TestCase
131131
*/
132132
private $addressRepositoryMock;
133133

134+
/**
135+
* @var \PHPUnit_Framework_MockObject_MockObject
136+
*/
137+
private $quoteFactoryMock;
138+
134139
/**
135140
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
136141
*/
@@ -241,10 +246,15 @@ public function testCreateEmptyCartAnonymous()
241246

242247
$quoteMock = $this->createMock(\Magento\Quote\Model\Quote::class);
243248

244-
$quoteAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class);
249+
$quoteAddress = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address::class)
250+
->disableOriginalConstructor()
251+
->setMethods(['setCollectShippingRates'])
252+
->getMock();
245253

246254
$quoteMock->expects($this->any())->method('setBillingAddress')->with($quoteAddress)->willReturnSelf();
247255
$quoteMock->expects($this->any())->method('setShippingAddress')->with($quoteAddress)->willReturnSelf();
256+
$quoteMock->expects($this->any())->method('getShippingAddress')->willReturn($quoteAddress);
257+
$quoteAddress->expects($this->once())->method('setCollectShippingRates')->with(true);
248258

249259
$this->quoteAddressFactory->expects($this->any())->method('create')->willReturn($quoteAddress);
250260

app/code/Magento/Store/Model/Store.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,18 +1166,29 @@ public function getCurrentUrl($fromStore = true)
11661166
if (!$this->isUseStoreInUrl()) {
11671167
$storeParsedQuery['___store'] = $this->getCode();
11681168
}
1169+
11691170
if ($fromStore !== false) {
11701171
$storeParsedQuery['___from_store'] = $fromStore ===
11711172
true ? $this->_storeManager->getStore()->getCode() : $fromStore;
11721173
}
11731174

1175+
$requestStringParts = explode('?', $requestString, 2);
1176+
$requestStringPath = $requestStringParts[0];
1177+
if (isset($requestStringParts[1])) {
1178+
parse_str($requestStringParts[1], $requestString);
1179+
} else {
1180+
$requestString = [];
1181+
}
1182+
1183+
$currentUrlQueryParams = array_merge($requestString, $storeParsedQuery);
1184+
11741185
$currentUrl = $storeParsedUrl['scheme']
11751186
. '://'
11761187
. $storeParsedUrl['host']
11771188
. (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '')
11781189
. $storeParsedUrl['path']
1179-
. $requestString
1180-
. ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : '');
1190+
. $requestStringPath
1191+
. ($currentUrlQueryParams ? '?' . http_build_query($currentUrlQueryParams, '', '&') : '');
11811192

11821193
return $currentUrl;
11831194
}

app/code/Magento/Swatches/view/adminhtml/web/css/swatches.css

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

6+
#swatch-visual-options-panel{
7+
overflow: visible;
8+
}
9+
610
.swatch_sub-menu_container {
711
position: absolute;
812
z-index: 9999;

0 commit comments

Comments
 (0)