Skip to content

Commit 1cf98e2

Browse files
author
Yurii Hryhoriev
committed
MAGETWO-61560: Moving all attributes out from 'Advanced Pricing' group causes error
1 parent 25de49d commit 1cf98e2

File tree

3 files changed

+98
-5
lines changed

3 files changed

+98
-5
lines changed

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ protected function setUp()
5656
$this->productMock = $this->getMockBuilder(ProductInterface::class)
5757
->setMethods([
5858
'getId',
59+
'getTypeId',
5960
'getStoreId',
6061
'getResource',
6162
'getData',

app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ConfigurablePriceTest.php

Lines changed: 96 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,105 @@ class ConfigurablePriceTest extends AbstractModifierTest
1515
*/
1616
protected function createModel()
1717
{
18-
return $this->objectManager->getObject(ConfigurablePriceModifier::class);
18+
return $this->objectManager->getObject(ConfigurablePriceModifier::class, ['locator' => $this->locatorMock]);
1919
}
2020

21-
public function testModifyMeta()
21+
/**
22+
* @param array $metaInput
23+
* @param array $metaOutput
24+
* @dataProvider metaDataProvider
25+
*/
26+
public function testModifyMeta($metaInput, $metaOutput)
2227
{
23-
$meta = ['initial' => 'meta'];
28+
$this->productMock->expects($this->any())
29+
->method('getTypeId')
30+
->willReturn(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE);
31+
32+
$metaResult = $this->getModel()->modifyMeta($metaInput);
33+
$this->assertEquals($metaResult, $metaOutput);
34+
}
2435

25-
$this->assertArrayHasKey('initial', $this->getModel()->modifyMeta($meta));
36+
/**
37+
* @return array
38+
*/
39+
public function metaDataProvider()
40+
{
41+
return [
42+
[
43+
'metaInput' => [
44+
'pruduct-details' => [
45+
'children' => [
46+
'container_price' => [
47+
'children' => [
48+
'advanced_pricing_button' => [
49+
'arguments' => []
50+
]
51+
]
52+
]
53+
]
54+
]
55+
],
56+
'metaOutput' => [
57+
'pruduct-details' => [
58+
'children' => [
59+
'container_price' => [
60+
'children' => [
61+
'advanced_pricing_button' => [
62+
'arguments' => [
63+
'data' => [
64+
'config' => [
65+
'visible' => 0,
66+
'disabled' => 1,
67+
],
68+
],
69+
],
70+
],
71+
'price' => [
72+
'arguments' => [
73+
'data' => [
74+
'config' => [
75+
'component' =>
76+
'Magento_ConfigurableProduct/js/components/price-configurable'
77+
],
78+
],
79+
],
80+
],
81+
],
82+
],
83+
],
84+
]
85+
]
86+
], [
87+
'metaInput' => [
88+
'pruduct-details' => [
89+
'children' => [
90+
'container_price' => [
91+
'children' => []
92+
]
93+
]
94+
]
95+
],
96+
'metaOutput' => [
97+
'pruduct-details' => [
98+
'children' => [
99+
'container_price' => [
100+
'children' => [
101+
'price' => [
102+
'arguments' => [
103+
'data' => [
104+
'config' => [
105+
'component' =>
106+
'Magento_ConfigurableProduct/js/components/price-configurable'
107+
]
108+
]
109+
]
110+
]
111+
]
112+
]
113+
]
114+
]
115+
]
116+
]
117+
];
26118
}
27119
}

app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function modifyMeta(array $meta)
7373
);
7474
}
7575
if (
76-
!empty($meta[$groupCode]['children'][self::CODE_GROUP_PRICE]['children'][self::$advancedPricingButton])
76+
!empty($meta[$groupCode]['children'][self::CODE_GROUP_PRICE]['children'][self::$advancedPricingButton])
7777
) {
7878
$productTypeId = $this->locator->getProduct()->getTypeId();
7979
$visibilityConfig = ($productTypeId === ConfigurableType::TYPE_CODE)

0 commit comments

Comments
 (0)