Skip to content

Commit 53584cf

Browse files
committed
Merge branch 'develop' into develop-PR
2 parents 9ea513c + 4c02b66 commit 53584cf

File tree

54 files changed

+4452
-477
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4452
-477
lines changed

app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/**
1414
* "Reset to Defaults" button renderer
1515
*
16+
* @deprecated
1617
* @author Magento Core Team <core@magentocommerce.com>
1718
*/
1819
class Reset extends \Magento\Config\Block\System\Config\Form\Field

app/code/Magento/Backend/Test/Unit/Block/Page/System/Config/Robots/ResetTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
*/
1010
namespace Magento\Backend\Test\Unit\Block\Page\System\Config\Robots;
1111

12+
/**
13+
* Class ResetTest
14+
* @deprecated
15+
* @package Magento\Backend\Test\Unit\Block\Page\System\Config\Robots
16+
*/
1217
class ResetTest extends \PHPUnit_Framework_TestCase
1318
{
1419
/**

app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function getValue()
124124
$value = $product->getData('final_price') * ($selectionPriceValue / 100);
125125
} else {
126126
// calculate price for selection type fixed
127-
$value = $this->priceCurrency->convert($selectionPriceValue) * $this->quantity;
127+
$value = $this->priceCurrency->convert($selectionPriceValue);
128128
}
129129
}
130130
if (!$this->useRegularPrice) {

app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionPriceTest.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,67 @@ public function testGetValueTypeFixedWithoutSelectionPriceType($useRegularPrice)
313313
$this->assertEquals($expectedPrice, $this->selectionPrice->getValue());
314314
}
315315

316+
/**
317+
* test for method getValue with type Fixed and selectionPriceType is empty or zero
318+
*
319+
* @param bool $useRegularPrice
320+
* @dataProvider useRegularPriceDataProvider
321+
*/
322+
public function testFixedPriceWithMultipleQty($useRegularPrice)
323+
{
324+
$qty = 2;
325+
326+
$selectionPrice = new \Magento\Bundle\Pricing\Price\BundleSelectionPrice(
327+
$this->productMock,
328+
$qty,
329+
$this->calculatorMock,
330+
$this->priceCurrencyMock,
331+
$this->bundleMock,
332+
$this->eventManagerMock,
333+
$this->discountCalculatorMock,
334+
$useRegularPrice
335+
);
336+
337+
$this->setupSelectionPrice($useRegularPrice);
338+
$regularPrice = 100.125;
339+
$discountedPrice = 70.453;
340+
$convertedValue = 100.247;
341+
$actualPrice = $useRegularPrice ? $convertedValue : $discountedPrice;
342+
$expectedPrice = $useRegularPrice ? round($convertedValue, 2) : round($discountedPrice, 2);
343+
344+
$this->bundleMock->expects($this->once())
345+
->method('getPriceType')
346+
->will($this->returnValue(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED));
347+
$this->productMock->expects($this->once())
348+
->method('getSelectionPriceType')
349+
->will($this->returnValue(false));
350+
$this->productMock->expects($this->any())
351+
->method('getSelectionPriceValue')
352+
->will($this->returnValue($regularPrice));
353+
354+
$this->priceCurrencyMock->expects($this->once())
355+
->method('convert')
356+
->with($regularPrice)
357+
->will($this->returnValue($convertedValue));
358+
359+
if (!$useRegularPrice) {
360+
$this->discountCalculatorMock->expects($this->once())
361+
->method('calculateDiscount')
362+
->with(
363+
$this->equalTo($this->bundleMock),
364+
$this->equalTo($convertedValue)
365+
)
366+
->will($this->returnValue($discountedPrice));
367+
}
368+
369+
$this->priceCurrencyMock->expects($this->once())
370+
->method('round')
371+
->with($actualPrice)
372+
->will($this->returnValue($expectedPrice));
373+
374+
$this->assertEquals($expectedPrice, $selectionPrice->getValue());
375+
}
376+
316377
public function useRegularPriceDataProvider()
317378
{
318379
return [

app/code/Magento/Bundle/view/base/web/js/price-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ define([
5555
this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat);
5656
priceBox.priceBox('setDefault', this.options.optionConfig.prices);
5757
}
58-
this._applyQtyFix();
5958
this._applyOptionNodeFix(options);
6059

6160
options.on('change', this._onBundleOptionChanged.bind(this));
@@ -113,6 +112,7 @@ define([
113112
* Helper to fix backend behavior:
114113
* - if default qty large than 1 then backend multiply price in config
115114
*
115+
* @deprecated
116116
* @private
117117
*/
118118
_applyQtyFix: function applyQtyFix() {

app/code/Magento/Catalog/Setup/CategorySetup.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ class CategorySetup extends EavSetup
2424
*/
2525
private $categoryFactory;
2626

27+
/**
28+
* This should be set explicitly
29+
*/
30+
const CATEGORY_ENTITY_TYPE_ID = 3;
31+
32+
/**
33+
* This should be set explicitly
34+
*/
35+
const CATALOG_PRODUCT_ENTITY_TYPE_ID = 4;
36+
2737
/**
2838
* Init
2939
*
@@ -66,6 +76,7 @@ public function getDefaultEntities()
6676
{
6777
return [
6878
'catalog_category' => [
79+
'entity_type_id' => self::CATEGORY_ENTITY_TYPE_ID,
6980
'entity_model' => 'Magento\Catalog\Model\ResourceModel\Category',
7081
'attribute_model' => 'Magento\Catalog\Model\ResourceModel\Eav\Attribute',
7182
'table' => 'catalog_category_entity',
@@ -334,6 +345,7 @@ public function getDefaultEntities()
334345
],
335346
],
336347
'catalog_product' => [
348+
'entity_type_id' => self::CATALOG_PRODUCT_ENTITY_TYPE_ID,
337349
'entity_model' => 'Magento\Catalog\Model\ResourceModel\Product',
338350
'attribute_model' => 'Magento\Catalog\Model\ResourceModel\Eav\Attribute',
339351
'table' => 'catalog_product_entity',

app/code/Magento/Config/view/adminhtml/templates/page/system/config/robots/reset.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// @codingStandardsIgnoreFile
88

99
/**
10+
* @deprecated
1011
* @var $block \Magento\Backend\Block\Page\System\Config\Robots\Reset
1112
* @var $jsonHelper \Magento\Framework\Json\Helper\Data
1213
*/

app/code/Magento/Customer/Controller/Account/EditPost.php

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
namespace Magento\Customer\Controller\Account;
88

99
use Magento\Customer\Model\AuthenticationInterface;
10+
use Magento\Customer\Model\Customer\Mapper;
1011
use Magento\Customer\Model\EmailNotificationInterface;
1112
use Magento\Framework\App\Config\ScopeConfigInterface;
13+
use Magento\Framework\App\ObjectManager;
1214
use Magento\Framework\Data\Form\FormKey\Validator;
1315
use Magento\Customer\Api\AccountManagementInterface;
1416
use Magento\Customer\Api\CustomerRepositoryInterface;
@@ -68,6 +70,11 @@ class EditPost extends \Magento\Customer\Controller\AbstractAccount
6870
*/
6971
private $authentication;
7072

73+
/**
74+
* @var Mapper
75+
*/
76+
private $customerMapper;
77+
7178
/**
7279
* @param Context $context
7380
* @param Session $customerSession
@@ -101,7 +108,7 @@ private function getAuthentication()
101108
{
102109

103110
if (!($this->authentication instanceof AuthenticationInterface)) {
104-
return \Magento\Framework\App\ObjectManager::getInstance()->get(
111+
return ObjectManager::getInstance()->get(
105112
\Magento\Customer\Model\AuthenticationInterface::class
106113
);
107114
} else {
@@ -118,7 +125,7 @@ private function getAuthentication()
118125
private function getEmailNotification()
119126
{
120127
if (!($this->emailNotification instanceof EmailNotificationInterface)) {
121-
return \Magento\Framework\App\ObjectManager::getInstance()->get(
128+
return ObjectManager::getInstance()->get(
122129
EmailNotificationInterface::class
123130
);
124131
} else {
@@ -196,7 +203,7 @@ public function execute()
196203
private function getScopeConfig()
197204
{
198205
if (!($this->scopeConfig instanceof \Magento\Framework\App\Config\ScopeConfigInterface)) {
199-
return \Magento\Framework\App\ObjectManager::getInstance()->get(
206+
return ObjectManager::getInstance()->get(
200207
\Magento\Framework\App\Config\ScopeConfigInterface::class
201208
);
202209
} else {
@@ -241,7 +248,12 @@ private function populateNewCustomerDataObject(
241248
\Magento\Framework\App\RequestInterface $inputData,
242249
\Magento\Customer\Api\Data\CustomerInterface $currentCustomerData
243250
) {
244-
$customerDto = $this->customerExtractor->extract(self::FORM_DATA_EXTRACTOR_CODE, $inputData);
251+
$attributeValues = $this->getCustomerMapper()->toFlatArray($currentCustomerData);
252+
$customerDto = $this->customerExtractor->extract(
253+
self::FORM_DATA_EXTRACTOR_CODE,
254+
$inputData,
255+
$attributeValues
256+
);
245257
$customerDto->setId($currentCustomerData->getId());
246258
if (!$customerDto->getAddresses()) {
247259
$customerDto->setAddresses($currentCustomerData->getAddresses());
@@ -299,4 +311,19 @@ private function processChangeEmailRequest(\Magento\Customer\Api\Data\CustomerIn
299311
}
300312
}
301313
}
314+
315+
/**
316+
* Get Customer Mapper instance
317+
*
318+
* @return Mapper
319+
*
320+
* @deprecated
321+
*/
322+
private function getCustomerMapper()
323+
{
324+
if ($this->customerMapper === null) {
325+
$this->customerMapper = ObjectManager::getInstance()->get('Magento\Customer\Model\Customer\Mapper');
326+
}
327+
return $this->customerMapper;
328+
}
302329
}

app/code/Magento/Customer/Controller/Address/FormPost.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
use Magento\Customer\Api\Data\AddressInterfaceFactory;
1010
use Magento\Customer\Api\Data\RegionInterface;
1111
use Magento\Customer\Api\Data\RegionInterfaceFactory;
12+
use Magento\Customer\Model\Address\Mapper;
1213
use Magento\Customer\Model\Metadata\FormFactory;
1314
use Magento\Customer\Model\Session;
1415
use Magento\Directory\Helper\Data as HelperData;
1516
use Magento\Directory\Model\RegionFactory;
1617
use Magento\Framework\Api\DataObjectHelper;
1718
use Magento\Framework\App\Action\Context;
19+
use Magento\Framework\App\ObjectManager;
1820
use Magento\Framework\Controller\Result\ForwardFactory;
1921
use Magento\Framework\Data\Form\FormKey\Validator as FormKeyValidator;
2022
use Magento\Framework\Exception\InputException;
@@ -36,6 +38,11 @@ class FormPost extends \Magento\Customer\Controller\Address
3638
*/
3739
protected $helperData;
3840

41+
/**
42+
* @var Mapper
43+
*/
44+
private $customerAddressMapper;
45+
3946
/**
4047
* @param Context $context
4148
* @param Session $customerSession
@@ -127,12 +134,7 @@ protected function getExistingAddressData()
127134
if ($existingAddress->getCustomerId() !== $this->_getSession()->getCustomerId()) {
128135
throw new \Exception();
129136
}
130-
$existingAddressData = $this->_dataProcessor->buildOutputDataArray(
131-
$existingAddress,
132-
'\Magento\Customer\Api\Data\AddressInterface'
133-
);
134-
$existingAddressData['region_code'] = $existingAddress->getRegion()->getRegionCode();
135-
$existingAddressData['region'] = $existingAddress->getRegion()->getRegion();
137+
$existingAddressData = $this->getCustomerAddressMapper()->toFlatArray($existingAddress);
136138
}
137139
return $existingAddressData;
138140
}
@@ -212,4 +214,19 @@ public function execute()
212214

213215
return $this->resultRedirectFactory->create()->setUrl($this->_redirect->error($url));
214216
}
217+
218+
/**
219+
* Get Customer Address Mapper instance
220+
*
221+
* @return Mapper
222+
*
223+
* @deprecated
224+
*/
225+
private function getCustomerAddressMapper()
226+
{
227+
if ($this->customerAddressMapper === null) {
228+
$this->customerAddressMapper = ObjectManager::getInstance()->get('Magento\Customer\Model\Address\Mapper');
229+
}
230+
return $this->customerAddressMapper;
231+
}
215232
}

0 commit comments

Comments
 (0)