Skip to content

Commit 1ca6094

Browse files
Merge branch 'develop' of https://github.com/magento/magento2ce into MAGETWO-66853
2 parents 7a65b82 + 58edd7f commit 1ca6094

File tree

100 files changed

+3050
-596
lines changed

Some content is hidden

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

100 files changed

+3050
-596
lines changed

app/code/Magento/Authorizenet/etc/di.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@
1616
<argument name="storage" xsi:type="object">Magento\Authorizenet\Model\Directpost\Session\Storage</argument>
1717
</arguments>
1818
</type>
19-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
20-
<arguments>
21-
<argument name="configs" xsi:type="array">
22-
<item name="payment/authorizenet_directpost/login" xsi:type="string">1</item>
23-
<item name="payment/authorizenet_directpost/trans_key" xsi:type="string">1</item>
24-
<item name="payment/authorizenet_directpost/trans_md5" xsi:type="string">1</item>
25-
<item name="payment/authorizenet_directpost/merchant_email" xsi:type="string">1</item>
26-
</argument>
27-
</arguments>
28-
</type>
2919
<type name="Magento\Config\Model\Config\TypePool">
3020
<arguments>
3121
<argument name="sensitive" xsi:type="array">

app/code/Magento/Backend/etc/di.xml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,6 @@
171171
</argument>
172172
</arguments>
173173
</type>
174-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
175-
<arguments>
176-
<argument name="configs" xsi:type="array">
177-
<item name="trans_email/ident_general/name" xsi:type="string">1</item>
178-
<item name="trans_email/ident_general/email" xsi:type="string">1</item>
179-
<item name="trans_email/ident_sales/name" xsi:type="string">1</item>
180-
<item name="trans_email/ident_sales/email" xsi:type="string">1</item>
181-
<item name="trans_email/ident_support/name" xsi:type="string">1</item>
182-
<item name="trans_email/ident_support/email" xsi:type="string">1</item>
183-
<item name="trans_email/ident_custom1/name" xsi:type="string">1</item>
184-
<item name="trans_email/ident_custom1/email" xsi:type="string">1</item>
185-
<item name="trans_email/ident_custom2/name" xsi:type="string">1</item>
186-
<item name="trans_email/ident_custom2/email" xsi:type="string">1</item>
187-
<item name="admin/url/custom" xsi:type="string">1</item>
188-
<item name="admin/url/custom_path" xsi:type="string">1</item>
189-
</argument>
190-
</arguments>
191-
</type>
192174
<type name="Magento\Config\Model\Config\TypePool">
193175
<arguments>
194176
<argument name="sensitive" xsi:type="array">

app/code/Magento/Braintree/etc/di.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,6 @@
544544
</arguments>
545545
</type>
546546
<!-- END Settlement Report Section -->
547-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
548-
<arguments>
549-
<argument name="configs" xsi:type="array">
550-
<item name="payment/braintree/merchant_id" xsi:type="string">1</item>
551-
<item name="payment/braintree/public_key" xsi:type="string">1</item>
552-
<item name="payment/braintree/private_key" xsi:type="string">1</item>
553-
<item name="payment/braintree/merchant_account_id" xsi:type="string">1</item>
554-
<item name="payment/braintree/kount_id" xsi:type="string">1</item>
555-
<item name="payment/braintree_paypal/merchant_name_override" xsi:type="string">1</item>
556-
</argument>
557-
</arguments>
558-
</type>
559547
<type name="Magento\Config\Model\Config\TypePool">
560548
<arguments>
561549
<argument name="sensitive" xsi:type="array">

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,15 @@ public function getProductPrice(\Magento\Catalog\Model\Product $product)
317317
}
318318

319319
/**
320+
* Specifies that price rendering should be done for the list of products
321+
* i.e. rendering happens in the scope of product list, but not single product
322+
*
320323
* @return \Magento\Framework\Pricing\Render
321324
*/
322325
protected function getPriceRender()
323326
{
324-
return $this->getLayout()->getBlock('product.price.render.default');
327+
return $this->getLayout()->getBlock('product.price.render.default')
328+
->setData('is_product_list', true);
325329
}
326330

327331
/**

app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,19 @@ public function getCacheKeyInfo()
193193
{
194194
$cacheKeys = parent::getCacheKeyInfo();
195195
$cacheKeys['display_minimal_price'] = $this->getDisplayMinimalPrice();
196+
$cacheKeys['is_product_list'] = $this->isProductList();
196197
return $cacheKeys;
197198
}
199+
200+
/**
201+
* Get flag that price rendering should be done for the list of products
202+
* By default (if flag is not set) is false
203+
*
204+
* @return bool
205+
*/
206+
public function isProductList()
207+
{
208+
$isProductList = $this->getData('is_product_list');
209+
return $isProductList === true;
210+
}
198211
}

app/code/Magento/Catalog/Test/Unit/Block/Product/ListProductTest.php

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
*/
66
namespace Magento\Catalog\Test\Unit\Block\Product;
77

8+
use Magento\Catalog\Block\Product\Context;
9+
use Magento\Framework\Event\ManagerInterface;
10+
use Magento\Framework\Pricing\Render;
11+
use Magento\Framework\Url\Helper\Data;
12+
use Magento\Framework\View\LayoutInterface;
13+
814
/**
915
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1016
*/
@@ -46,7 +52,7 @@ class ListProductTest extends \PHPUnit_Framework_TestCase
4652
protected $typeInstanceMock;
4753

4854
/**
49-
* @var \Magento\Framework\Url\Helper\Data | \PHPUnit_Framework_MockObject_MockObject
55+
* @var Data | \PHPUnit_Framework_MockObject_MockObject
5056
*/
5157
protected $urlHelperMock;
5258

@@ -70,6 +76,16 @@ class ListProductTest extends \PHPUnit_Framework_TestCase
7076
*/
7177
protected $toolbarMock;
7278

79+
/**
80+
* @var Context|\PHPUnit_Framework_MockObject_MockObject
81+
*/
82+
private $context;
83+
84+
/**
85+
* @var Render|\PHPUnit_Framework_MockObject_MockObject
86+
*/
87+
private $renderer;
88+
7389
protected function setUp()
7490
{
7591
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -141,20 +157,28 @@ protected function setUp()
141157
false
142158
);
143159

144-
$this->urlHelperMock = $this->getMockBuilder(\Magento\Framework\Url\Helper\Data::class)
145-
->disableOriginalConstructor()->getMock();
160+
$this->urlHelperMock = $this->getMockBuilder(Data::class)->disableOriginalConstructor()->getMock();
161+
$this->context = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
162+
$this->renderer = $this->getMockBuilder(Render::class)->disableOriginalConstructor()->getMock();
163+
$eventManager = $this->getMockForAbstractClass(ManagerInterface::class, [], '', false);
164+
165+
$this->context->expects($this->any())->method('getRegistry')->willReturn($this->registryMock);
166+
$this->context->expects($this->any())->method('getCartHelper')->willReturn($this->cartHelperMock);
167+
$this->context->expects($this->any())->method('getLayout')->willReturn($this->layoutMock);
168+
$this->context->expects($this->any())->method('getEventManager')->willReturn($eventManager);
169+
146170
$this->block = $objectManager->getObject(
147171
\Magento\Catalog\Block\Product\ListProduct::class,
148172
[
149173
'registry' => $this->registryMock,
174+
'context' => $this->context,
150175
'layerResolver' => $layerResolver,
151176
'cartHelper' => $this->cartHelperMock,
152177
'postDataHelper' => $this->postDataHelperMock,
153178
'urlHelper' => $this->urlHelperMock,
154179
]
155180
);
156181
$this->block->setToolbarBlockName('mock');
157-
$this->block->setLayout($this->layoutMock);
158182
}
159183

160184
protected function tearDown()
@@ -257,4 +281,18 @@ public function testGetAddToCartPostParams()
257281
$result = $this->block->getAddToCartPostParams($this->productMock);
258282
$this->assertEquals($expectedPostData, $result);
259283
}
284+
285+
public function testSetIsProductListFlagOnGetProductPrice()
286+
{
287+
$this->renderer->expects($this->once())
288+
->method('setData')
289+
->with('is_product_list', true)
290+
->willReturnSelf();
291+
$this->layoutMock->expects($this->once())
292+
->method('getBlock')
293+
->with('product.price.render.default')
294+
->willReturn($this->renderer);
295+
296+
$this->block->getProductPrice($this->productMock);
297+
}
260298
}

app/code/Magento/Catalog/Test/Unit/Pricing/Render/FinalPriceBoxTest.php

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,63 @@ public function testGetCacheKey()
401401
$this->assertStringEndsWith('list-category-page', $result);
402402
}
403403

404-
public function testGetCacheKeyInfo()
404+
public function testGetCacheKeyInfoContainsDisplayMinimalPrice()
405405
{
406406
$this->assertArrayHasKey('display_minimal_price', $this->object->getCacheKeyInfo());
407407
}
408+
409+
/**
410+
* Test when is_product_list flag is not specified
411+
*/
412+
public function testGetCacheKeyInfoContainsIsProductListFlagByDefault()
413+
{
414+
$cacheInfo = $this->object->getCacheKeyInfo();
415+
self::assertArrayHasKey('is_product_list', $cacheInfo);
416+
self::assertFalse($cacheInfo['is_product_list']);
417+
}
418+
419+
/**
420+
* Test when is_product_list flag is specified
421+
*
422+
* @param bool $flag
423+
* @dataProvider isProductListDataProvider
424+
*/
425+
public function testGetCacheKeyInfoContainsIsProductListFlag($flag)
426+
{
427+
$this->object->setData('is_product_list', $flag);
428+
$cacheInfo = $this->object->getCacheKeyInfo();
429+
self::assertArrayHasKey('is_product_list', $cacheInfo);
430+
self::assertEquals($flag, $cacheInfo['is_product_list']);
431+
}
432+
433+
/**
434+
* Test when is_product_list flag is not specified
435+
*/
436+
public function testIsProductListByDefault()
437+
{
438+
self::assertFalse($this->object->isProductList());
439+
}
440+
441+
/**
442+
* Test when is_product_list flag is specified
443+
*
444+
* @param bool $flag
445+
* @dataProvider isProductListDataProvider
446+
*/
447+
public function testIsProductList($flag)
448+
{
449+
$this->object->setData('is_product_list', $flag);
450+
self::assertEquals($flag, $this->object->isProductList());
451+
}
452+
453+
/**
454+
* @return array
455+
*/
456+
public function isProductListDataProvider()
457+
{
458+
return [
459+
'is_not_product_list' => [false],
460+
'is_product_list' => [true],
461+
];
462+
}
408463
}

app/code/Magento/Checkout/etc/di.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@
4242
</argument>
4343
</arguments>
4444
</type>
45-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
46-
<arguments>
47-
<argument name="configs" xsi:type="array">
48-
<item name="checkout/payment_failed/copy_to" xsi:type="string">1</item>
49-
</argument>
50-
</arguments>
51-
</type>
5245
<type name="Magento\Config\Model\Config\TypePool">
5346
<arguments>
5447
<argument name="sensitive" xsi:type="array">

app/code/Magento/Config/Console/Command/ConfigSet/ProcessorFacade.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
namespace Magento\Config\Console\Command\ConfigSet;
77

88
use Magento\Config\Console\Command\ConfigSetCommand;
9-
use Magento\Config\Model\Config\PathValidator;
109
use Magento\Framework\App\Scope\ValidatorInterface;
10+
use Magento\Config\Model\Config\PathValidator;
11+
use Magento\Framework\Exception\LocalizedException;
1112
use Magento\Framework\Exception\ConfigurationMismatchException;
1213
use Magento\Framework\Exception\CouldNotSaveException;
13-
use Magento\Framework\Exception\LocalizedException;
1414
use Magento\Framework\Exception\ValidatorException;
1515

1616
/**
@@ -21,7 +21,10 @@
2121
class ProcessorFacade
2222
{
2323
/**
24-
* The scope validator.
24+
* The scope and scope code validator.
25+
*
26+
* Checks if scope and scope code exist, and scope code belongs to scope.
27+
* For example, scope "websites" and scope code "base" exist, and scope code "base" belongs to scope "website".
2528
*
2629
* @var ValidatorInterface
2730
*/
@@ -30,6 +33,8 @@ class ProcessorFacade
3033
/**
3134
* The path validator.
3235
*
36+
* Checks whether the config path present in configuration structure.
37+
*
3338
* @var PathValidator
3439
*/
3540
private $pathValidator;
@@ -65,15 +70,18 @@ public function __construct(
6570
* @param string $scopeCode The scope code
6671
* @param boolean $lock The lock flag
6772
* @return string Processor response message
68-
* @throws LocalizedException If scope validation failed
69-
* @throws ValidatorException If path validation failed
70-
* @throws CouldNotSaveException If processing failed
73+
* @throws ValidatorException If some validation is wrong
74+
* @throws CouldNotSaveException If cannot save config value
7175
* @throws ConfigurationMismatchException If processor can not be instantiated
7276
*/
7377
public function process($path, $value, $scope, $scopeCode, $lock)
7478
{
75-
$this->scopeValidator->isValid($scope, $scopeCode);
76-
$this->pathValidator->validate($path);
79+
try {
80+
$this->scopeValidator->isValid($scope, $scopeCode);
81+
$this->pathValidator->validate($path);
82+
} catch (LocalizedException $exception) {
83+
throw new ValidatorException(__($exception->getMessage()), $exception);
84+
}
7785

7886
$processor = $lock
7987
? $this->configSetProcessorFactory->create(ConfigSetProcessorFactory::TYPE_LOCK)

app/code/Magento/Config/Console/Command/ConfigSetCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ protected function configure()
116116
protected function execute(InputInterface $input, OutputInterface $output)
117117
{
118118
try {
119+
$areaScope = $this->scope->getCurrentScope();
119120
// Emulating adminhtml scope to be able to read configs.
120121
$this->state->emulateAreaCode(Area::AREA_ADMINHTML, function () use ($input, $output) {
121122
$this->scope->setCurrentScope(Area::AREA_ADMINHTML);
@@ -131,6 +132,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
131132
$output->writeln('<info>' . $message . '</info>');
132133
});
133134

135+
$this->scope->setCurrentScope($areaScope);
136+
134137
return Cli::RETURN_SUCCESS;
135138
} catch (\Exception $exception) {
136139
$output->writeln('<error>' . $exception->getMessage() . '</error>');

app/code/Magento/Config/Model/Config/TypePool.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
*
1111
* Used when you need to know if the configuration path belongs to a certain type.
1212
* Participates in the mechanism for creating the configuration dump file.
13-
* There are several types:
14-
* - sensitive - the fields that have this type will not be written in the dump configuration;
15-
* - environment - the fields that have this type will not be written to the dump configuration.
1613
*/
1714
class TypePool
1815
{
@@ -88,7 +85,7 @@ public function isPresent($path, $type)
8885
* );
8986
* ```
9087
*
91-
* @param string $type Type configuration fields paths. Allowed values of types:
88+
* @param string $type Type of configuration fields. Allowed values of types:
9289
* - sensitive or TypePool::TYPE_SENSITIVE;
9390
* - environment or TypePool::TYPE_ENVIRONMENT.
9491
* @return array

0 commit comments

Comments
 (0)