@@ -9,15 +9,15 @@ class GetterSetterTest extends \PHPUnit_Framework_TestCase
9
9
{
10
10
/**
11
11
* @param string $className
12
- * @param array $variableNames
12
+ * @param array $variables
13
13
* @dataProvider dataProviderGettersSetters
14
14
*/
15
- public function testGettersSetters ($ className = null , $ variableNames = null )
15
+ public function testGettersSetters ($ className = null , $ variables = null )
16
16
{
17
17
$ objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
18
18
$ classObject = $ objectManager ->getObject ($ className );
19
19
20
- foreach ($ variableNames as $ variableName => $ variableValue ) {
20
+ foreach ($ variables as $ variableName => $ variableValue ) {
21
21
$ setterName = 'set ' . $ variableName ;
22
22
23
23
$ this ->assertTrue (method_exists ($ classObject , $ setterName ),
@@ -27,23 +27,23 @@ public function testGettersSetters($className = null, $variableNames = null)
27
27
if (strpos ($ variableValue [0 ], 'Magento ' ) !== false ) {
28
28
$ obj = $ objectManager ->getObject ($ variableValue [0 ]);
29
29
$ variableValue = [$ obj ];
30
- $ variableNames [$ variableName ] = $ variableValue ;
30
+ $ variables [$ variableName ] = $ variableValue ;
31
31
}
32
32
} else if (strpos ($ variableValue , 'Magento ' ) !== false ) {
33
33
$ obj = $ objectManager ->getObject ($ variableValue );
34
34
$ variableValue = $ obj ;
35
- $ variableNames [$ variableName ] = $ variableValue ;
35
+ $ variables [$ variableName ] = $ variableValue ;
36
36
}
37
- $ this ->assertNotFalse (call_user_func (array ( $ classObject , $ setterName) , $ variableValue ),
37
+ $ this ->assertNotFalse (call_user_func ([ $ classObject , $ setterName] , $ variableValue ),
38
38
"Calling method " . $ setterName . " failed in " . $ className );
39
39
}
40
40
41
- foreach ($ variableNames as $ variableName => $ variableValue ) {
41
+ foreach ($ variables as $ variableName => $ variableValue ) {
42
42
$ getterName = 'get ' . $ variableName ;
43
43
44
44
$ this ->assertTrue (method_exists ($ classObject , $ getterName ),
45
45
"Method " . $ getterName . " does not exist in " . $ className );
46
- $ result = call_user_func (array ( $ classObject , $ getterName) );
46
+ $ result = call_user_func ([ $ classObject , $ getterName] );
47
47
$ this ->assertNotFalse ($ result ,
48
48
"Calling method " . $ getterName . " failed in " . $ className );
49
49
$ this ->assertSame ($ result , $ variableValue ,
@@ -60,98 +60,193 @@ public function dataProviderGettersSetters()
60
60
return [
61
61
[
62
62
'Magento\Tax\Model\TaxDetails\AppliedTax ' ,
63
- ['TaxRateKey ' => 'taxRateKey ' , 'Percent ' => 1.0 , 'Amount ' => 1.0 ,
64
- 'Rates ' => ['Magento\Tax\Model\TaxDetails\AppliedTaxRate ' ],
65
- 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\AppliedTaxExtension ' ]
63
+ [
64
+ 'TaxRateKey ' => 'taxRateKey ' ,
65
+ 'Percent ' => 1.0 ,
66
+ 'Amount ' => 1.0 ,
67
+ 'Rates ' =>
68
+ [
69
+ 'Magento\Tax\Model\TaxDetails\AppliedTaxRate '
70
+ ],
71
+ 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\AppliedTaxExtension '
72
+ ]
66
73
],
67
74
[
68
75
'Magento\Tax\Model\TaxDetails\AppliedTaxRate ' ,
69
- ['Code ' => 'code ' , 'Title ' => 'title ' , 'Percent ' => 1.0 ,
70
- 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\AppliedTaxRateExtension ' ]
76
+ [
77
+ 'Code ' => 'code ' ,
78
+ 'Title ' => 'title ' ,
79
+ 'Percent ' => 1.0 ,
80
+ 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\AppliedTaxRateExtension '
81
+ ]
71
82
],
72
83
[
73
84
'Magento\Tax\Model\Sales\Order\Tax ' ,
74
- ['Code ' => 'code ' , 'Title ' => 'title ' , 'Percent ' => 1.0 , 'Amount ' => 'amount ' ,
75
- 'BaseAmount ' => 'baseAmount ' ,
76
- 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtension ' ]
85
+ [
86
+ 'Code ' => 'code ' ,
87
+ 'Title ' => 'title ' ,
88
+ 'Percent ' => 1.0 ,
89
+ 'Amount ' => 'amount ' ,
90
+ 'BaseAmount ' => 'baseAmount ' ,
91
+ 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtension '
92
+ ]
77
93
],
78
94
[
79
95
'Magento\Tax\Model\Sales\Order\Details ' ,
80
- ['AppliedTaxes ' => ['Magento\Tax\Model\Sales\Order\Tax ' ],
81
- 'Items ' => ['Magento\Tax\Model\Sales\Order\Tax\Item ' ],
82
- 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\OrderTaxDetailsExtension ' ]
96
+ [
97
+ 'AppliedTaxes ' =>
98
+ [
99
+ 'Magento\Tax\Model\Sales\Order\Tax '
100
+ ],
101
+ 'Items ' =>
102
+ [
103
+ 'Magento\Tax\Model\Sales\Order\Tax\Item '
104
+ ],
105
+ 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\OrderTaxDetailsExtension '
106
+ ]
83
107
],
84
108
[
85
109
'Magento\Tax\Model\Sales\Order\Tax\Item ' ,
86
- ['Type ' => 'type ' , 'ItemId ' => 1 , 'AssociatedItemId ' => 1 ,
87
- 'AppliedTaxes ' => ['Magento\Tax\Model\Sales\Order\Tax ' ],
88
- 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\OrderTaxDetailsItemExtension ' ]
110
+ [
111
+ 'Type ' => 'type ' ,
112
+ 'ItemId ' => 1 ,
113
+ 'AssociatedItemId ' => 1 ,
114
+ 'AppliedTaxes ' =>
115
+ [
116
+ 'Magento\Tax\Model\Sales\Order\Tax '
117
+ ],
118
+ 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\OrderTaxDetailsItemExtension '
119
+ ]
89
120
],
90
121
[
91
122
'Magento\Tax\Model\Sales\Quote\QuoteDetails ' ,
92
- ['BillingAddress ' => 'Magento\Customer\Model\Data\Address ' ,
93
- 'ShippingAddress ' => 'Magento\Customer\Model\Data\Address ' ,
94
- 'CustomerTaxClassKey ' => 'Magento\Tax\Model\TaxClass\Key ' ,
95
- 'CustomerId ' => 1 ,
96
- 'Items ' => ['Magento\Tax\Model\Sales\Order\Tax\Item ' ],
97
- 'CustomerTaxClassId ' => 1 ,
98
- 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\QuoteDetailsExtension ' ]
123
+ [
124
+ 'BillingAddress ' => 'Magento\Customer\Model\Data\Address ' ,
125
+ 'ShippingAddress ' => 'Magento\Customer\Model\Data\Address ' ,
126
+ 'CustomerTaxClassKey ' => 'Magento\Tax\Model\TaxClass\Key ' ,
127
+ 'CustomerId ' => 1 ,
128
+ 'Items ' =>
129
+ [
130
+ 'Magento\Tax\Model\Sales\Order\Tax\Item '
131
+ ],
132
+ 'CustomerTaxClassId ' => 1 ,
133
+ 'ExtensionAttributes ' => 'Magento\Tax\Api\Data\QuoteDetailsExtension '
134
+ ]
99
135
],
100
136
[
101
137
'Magento\Tax\Model\Sales\Quote\ItemDetails ' ,
102
- ['Code ' => 'code ' , 'Type ' => 'type ' ,
103
- 'TaxClassKey ' => 'Magento\Tax\Model\TaxClass\Key ' ,
104
- 'UnitPrice ' => 1.0 , 'Quantity ' => 1.0 ,
105
- 'IsTaxIncluded ' => true , 'ShortDescription ' => 'shortDescription ' ,
106
- 'DiscountAmount ' => 1.0 , 'ParentCode ' => 'parentCode ' , 'AssociatedItemCode ' => 1 ,
107
- 'TaxClassId ' => 1 ,
108
- 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\QuoteDetailsItemExtension ' ]
138
+ [
139
+ 'Code ' => 'code ' ,
140
+ 'Type ' => 'type ' ,
141
+ 'TaxClassKey ' => 'Magento\Tax\Model\TaxClass\Key ' ,
142
+ 'UnitPrice ' => 1.0 ,
143
+ 'Quantity ' => 1.0 ,
144
+ 'IsTaxIncluded ' => true ,
145
+ 'ShortDescription ' => 'shortDescription ' ,
146
+ 'DiscountAmount ' => 1.0 ,
147
+ 'ParentCode ' => 'parentCode ' ,
148
+ 'AssociatedItemCode ' => 1 ,
149
+ 'TaxClassId ' => 1 ,
150
+ 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\QuoteDetailsItemExtension '
151
+ ]
109
152
],
110
153
[
111
154
'Magento\Tax\Model\ClassModel ' ,
112
- ['ClassId ' => 1 , 'ClassName ' => 'className ' , 'ClassType ' => 'classType ' ,
113
- 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxClassExtension ' ]
155
+ [
156
+ 'ClassId ' => 1 ,
157
+ 'ClassName ' => 'className ' ,
158
+ 'ClassType ' => 'classType ' ,
159
+ 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxClassExtension '
160
+ ]
114
161
],
115
162
[
116
163
'Magento\Tax\Model\TaxClass\Key ' ,
117
- ['Type ' => 'type ' , 'Value ' => 'value ' ,
118
- 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxClassKeyExtension ' ]
164
+ [
165
+ 'Type ' => 'type ' ,
166
+ 'Value ' => 'value ' ,
167
+ 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxClassKeyExtension '
168
+ ]
119
169
],
120
170
[
121
171
'Magento\Tax\Model\TaxDetails\TaxDetails ' ,
122
- ['Subtotal ' => 1.0 , 'TaxAmount ' => 1.0 ,
123
- 'DiscountTaxCompensationAmount ' => 1.0 ,
124
- 'AppliedTaxes ' => ['Magento\Tax\Model\TaxDetails\AppliedTax ' ],
125
- 'Items ' => ['Magento\Tax\Model\TaxDetails\ItemDetails ' ],
126
- 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxDetailsExtension ' ]
172
+ [
173
+ 'Subtotal ' => 1.0 ,
174
+ 'TaxAmount ' => 1.0 ,
175
+ 'DiscountTaxCompensationAmount ' => 1.0 ,
176
+ 'AppliedTaxes ' =>
177
+ [
178
+ 'Magento\Tax\Model\TaxDetails\AppliedTax '
179
+ ],
180
+ 'Items ' =>
181
+ [
182
+ 'Magento\Tax\Model\TaxDetails\ItemDetails '
183
+ ],
184
+ 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxDetailsExtension '
185
+ ]
127
186
],
128
187
[
129
188
'Magento\Tax\Model\TaxDetails\ItemDetails ' ,
130
- ['Code ' => 'code ' , 'Type ' => 'type ' , 'TaxPercent ' => 1.0 , 'Price ' => 1.0 , 'PriceInclTax ' => 1.0 ,
131
- 'RowTotal ' => 1.0 , 'RowTotalInclTax ' => 1.0 , 'RowTax ' => 1.0 , 'TaxableAmount ' => 1.0 ,
132
- 'DiscountAmount ' => 1.0 , 'DiscountTaxCompensationAmount ' => 1.0 ,
133
- 'AppliedTaxes ' => ['Magento\Tax\Model\TaxDetails\AppliedTax ' ],
134
- 'AssociatedItemCode ' => 1 ,
135
- 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxDetailsItemExtension ' ]
189
+ [
190
+ 'Code ' => 'code ' ,
191
+ 'Type ' => 'type ' ,
192
+ 'TaxPercent ' => 1.0 ,
193
+ 'Price ' => 1.0 ,
194
+ 'PriceInclTax ' => 1.0 ,
195
+ 'RowTotal ' => 1.0 ,
196
+ 'RowTotalInclTax ' => 1.0 ,
197
+ 'RowTax ' => 1.0 ,
198
+ 'TaxableAmount ' => 1.0 ,
199
+ 'DiscountAmount ' => 1.0 ,
200
+ 'DiscountTaxCompensationAmount ' => 1.0 ,
201
+ 'AppliedTaxes ' =>
202
+ [
203
+ 'Magento\Tax\Model\TaxDetails\AppliedTax '
204
+ ],
205
+ 'AssociatedItemCode ' => 1 ,
206
+ 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxDetailsItemExtension '
207
+ ]
136
208
],
137
209
[
138
210
'Magento\Tax\Model\Calculation\Rate ' ,
139
- ['Id ' => 1 , 'TaxCountryId ' => 'taxCountryId ' , 'TaxRegionId ' => 1 , 'RegionName ' => 'regionName ' ,
140
- 'TaxPostcode ' => 'taxPostCode ' , 'ZipIsRange ' => 1 , 'ZipFrom ' => 1 , 'ZipTo ' => 1 ,
141
- 'Rate ' => 1.0 , 'Code ' => 'code ' ,
142
- 'Titles ' => ['Magento\Tax\Model\Calculation\Rate\Title ' ],
143
- 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxRateExtension ' ]
211
+ [
212
+ 'Id ' => 1 ,
213
+ 'TaxCountryId ' => 'taxCountryId ' ,
214
+ 'TaxRegionId ' => 1 ,
215
+ 'RegionName ' => 'regionName ' ,
216
+ 'TaxPostcode ' => 'taxPostCode ' ,
217
+ 'ZipIsRange ' => 1 ,
218
+ 'ZipFrom ' => 1 ,
219
+ 'ZipTo ' => 1 ,
220
+ 'Rate ' => 1.0 ,
221
+ 'Code ' => 'code ' ,
222
+ 'Titles ' =>
223
+ [
224
+ 'Magento\Tax\Model\Calculation\Rate\Title '
225
+ ],
226
+ 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxRateExtension '
227
+ ]
144
228
],
145
229
[
146
230
'Magento\Tax\Model\Calculation\Rate\Title ' ,
147
- ['StoreId ' => 'storeId ' , 'Value ' => 'value ' ,
148
- 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxRateTitleExtension ' ]
231
+ [
232
+ 'StoreId ' => 'storeId ' ,
233
+ 'Value ' => 'value ' ,
234
+ 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxRateTitleExtension '
235
+ ]
149
236
],
150
237
[
151
238
'Magento\Tax\Model\Calculation\Rule ' ,
152
- ['Id ' => 1 , 'Code ' => 'code ' , 'Priority ' => 1 , 'Position ' => 1 , 'CustomerTaxClassIds ' => [1 ],
153
- 'ProductTaxClassIds ' => [1 ], 'TaxRateIds ' => [1 ], 'CalculateSubtotal ' => true ,
154
- 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxRuleExtension ' ]
239
+ [
240
+ 'Id ' => 1 ,
241
+ 'Code ' => 'code ' ,
242
+ 'Priority ' => 1 ,
243
+ 'Position ' => 1 ,
244
+ 'CustomerTaxClassIds ' => [1 ],
245
+ 'ProductTaxClassIds ' => [1 ],
246
+ 'TaxRateIds ' => [1 ],
247
+ 'CalculateSubtotal ' => true ,
248
+ 'ExtensionAttributes ' => '\Magento\Tax\Api\Data\TaxRuleExtension '
249
+ ]
155
250
]
156
251
];
157
252
}
0 commit comments