File tree Expand file tree Collapse file tree 3 files changed +98
-5
lines changed
Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier
Test/Unit/Ui/DataProvider/Product/Form/Modifier
Ui/DataProvider/Product/Form/Modifier Expand file tree Collapse file tree 3 files changed +98
-5
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ protected function setUp()
56
56
$ this ->productMock = $ this ->getMockBuilder (ProductInterface::class)
57
57
->setMethods ([
58
58
'getId ' ,
59
+ 'getTypeId ' ,
59
60
'getStoreId ' ,
60
61
'getResource ' ,
61
62
'getData ' ,
Original file line number Diff line number Diff line change @@ -15,13 +15,105 @@ class ConfigurablePriceTest extends AbstractModifierTest
15
15
*/
16
16
protected function createModel ()
17
17
{
18
- return $ this ->objectManager ->getObject (ConfigurablePriceModifier::class);
18
+ return $ this ->objectManager ->getObject (ConfigurablePriceModifier::class, [ ' locator ' => $ this -> locatorMock ] );
19
19
}
20
20
21
- public function testModifyMeta ()
21
+ /**
22
+ * @param array $metaInput
23
+ * @param array $metaOutput
24
+ * @dataProvider metaDataProvider
25
+ */
26
+ public function testModifyMeta ($ metaInput , $ metaOutput )
22
27
{
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
+ }
24
35
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
+ ];
26
118
}
27
119
}
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ public function modifyMeta(array $meta)
73
73
);
74
74
}
75
75
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 ])
77
77
) {
78
78
$ productTypeId = $ this ->locator ->getProduct ()->getTypeId ();
79
79
$ visibilityConfig = ($ productTypeId === ConfigurableType::TYPE_CODE )
You can’t perform that action at this time.
0 commit comments