Skip to content

Commit

Permalink
Merge pull request #1641 from magento-engcom/2.2-develop-prs
Browse files Browse the repository at this point in the history
[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
  • Loading branch information
ishakhsuvarov authored Oct 31, 2017
2 parents 373bd01 + 09b449b commit ea5e982
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 55 deletions.
19 changes: 8 additions & 11 deletions app/code/Magento/Backup/Model/BackupFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,20 @@ public function __construct(\Magento\Framework\ObjectManagerInterface $objectMan
*/
public function create($timestamp, $type)
{
$backupId = $timestamp . '_' . $type;
$fsCollection = $this->_objectManager->get(\Magento\Backup\Model\Fs\Collection::class);
$backupInstance = $this->_objectManager->get(\Magento\Backup\Model\Backup::class);

foreach ($fsCollection as $backup) {
if ($backup->getId() == $backupId) {
$backupInstance->setType(
$backup->getType()
)->setTime(
$backup->getTime()
)->setName(
$backup->getName()
)->setPath(
$backup->getPath()
);
if ($backup->getTime() === (int) $timestamp && $backup->getType() === $type) {
$backupInstance->setData(['id' => $backup->getId()])
->setType($backup->getType())
->setTime($backup->getTime())
->setName($backup->getName())
->setPath($backup->getPath());
break;
}
}

return $backupInstance;
}
}
59 changes: 23 additions & 36 deletions app/code/Magento/Backup/Test/Unit/Model/BackupFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,42 +77,29 @@ protected function setUp()

public function testCreate()
{
$this->_backupModel->expects(
$this->once()
)->method(
'setType'
)->with(
$this->_data['type']
)->will(
$this->returnSelf()
);
$this->_backupModel->expects(
$this->once()
)->method(
'setTime'
)->with(
$this->_data['time']
)->will(
$this->returnSelf()
);
$this->_backupModel->expects(
$this->once()
)->method(
'setName'
)->with(
$this->_data['name']
)->will(
$this->returnSelf()
);
$this->_backupModel->expects(
$this->once()
)->method(
'setPath'
)->with(
$this->_data['path']
)->will(
$this->returnSelf()
);
$this->_backupModel->expects($this->once())
->method('setType')
->with($this->_data['type'])
->will($this->returnSelf());

$this->_backupModel->expects($this->once())
->method('setTime')
->with($this->_data['time'])
->will($this->returnSelf());

$this->_backupModel->expects($this->once())
->method('setName')
->with($this->_data['name'])
->will($this->returnSelf());

$this->_backupModel->expects($this->once())
->method('setPath')
->with($this->_data['path'])
->will($this->returnSelf());

$this->_backupModel->expects($this->once())
->method('setData')
->will($this->returnSelf());

$this->_instance->create('1385661590', 'snapshot');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ define([

if (component) {
component.visible(visible);

/*eslint-disable max-depth */
if (_.isFunction(component.clear)) {
component.clear();
}
}
}
}, this);
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ public function createEmptyCart()
$quote->setShippingAddress($this->quoteAddressFactory->create());

try {
$quote->getShippingAddress()->setCollectShippingRates(true);

$this->quoteRepository->save($quote);
} catch (\Exception $e) {
throw new CouldNotSaveException(__('Cannot create quote'));
Expand Down
12 changes: 11 additions & 1 deletion app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ class QuoteManagementTest extends \PHPUnit\Framework\TestCase
*/
private $addressRepositoryMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $quoteFactoryMock;

/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
Expand Down Expand Up @@ -241,10 +246,15 @@ public function testCreateEmptyCartAnonymous()

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

$quoteAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class);
$quoteAddress = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address::class)
->disableOriginalConstructor()
->setMethods(['setCollectShippingRates'])
->getMock();

$quoteMock->expects($this->any())->method('setBillingAddress')->with($quoteAddress)->willReturnSelf();
$quoteMock->expects($this->any())->method('setShippingAddress')->with($quoteAddress)->willReturnSelf();
$quoteMock->expects($this->any())->method('getShippingAddress')->willReturn($quoteAddress);
$quoteAddress->expects($this->once())->method('setCollectShippingRates')->with(true);

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

Expand Down
15 changes: 13 additions & 2 deletions app/code/Magento/Store/Model/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -1166,18 +1166,29 @@ public function getCurrentUrl($fromStore = true)
if (!$this->isUseStoreInUrl()) {
$storeParsedQuery['___store'] = $this->getCode();
}

if ($fromStore !== false) {
$storeParsedQuery['___from_store'] = $fromStore ===
true ? $this->_storeManager->getStore()->getCode() : $fromStore;
}

$requestStringParts = explode('?', $requestString, 2);
$requestStringPath = $requestStringParts[0];
if (isset($requestStringParts[1])) {
parse_str($requestStringParts[1], $requestString);
} else {
$requestString = [];
}

$currentUrlQueryParams = array_merge($requestString, $storeParsedQuery);

$currentUrl = $storeParsedUrl['scheme']
. '://'
. $storeParsedUrl['host']
. (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '')
. $storeParsedUrl['path']
. $requestString
. ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : '');
. $requestStringPath
. ($currentUrlQueryParams ? '?' . http_build_query($currentUrlQueryParams, '', '&') : '');

return $currentUrl;
}
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Swatches/view/adminhtml/web/css/swatches.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* See COPYING.txt for license details.
*/

#swatch-visual-options-panel{
overflow: visible;
}

.swatch_sub-menu_container {
position: absolute;
z-index: 9999;
Expand Down

0 comments on commit ea5e982

Please sign in to comment.