@@ -73,6 +73,7 @@ public function testAttributeTypeResolver()
73
73
];
74
74
$ attributeTypes = ['String ' , 'Int ' , 'Float ' ,'Boolean ' , 'Float ' ];
75
75
$ inputTypes = ['textarea ' , 'select ' , 'price ' , 'boolean ' , 'price ' ];
76
+
76
77
$ this ->assertAttributeType ($ attributeTypes , $ expectedAttributeCodes , $ entityType , $ inputTypes , $ response );
77
78
}
78
79
@@ -173,7 +174,7 @@ public function testComplexAttributeTypeResolver()
173
174
'text ' ,
174
175
'gallery '
175
176
];
176
- $ this ->assertAttributeType ($ attributeTypes , $ expectedAttributeCodes , $ entityTypes , $ inputTypes , $ response );
177
+ $ this ->assertComplexAttributeType ($ attributeTypes , $ expectedAttributeCodes , $ entityTypes , $ inputTypes , $ response );
177
178
}
178
179
179
180
/**
@@ -236,7 +237,7 @@ public function testUnDefinedAttributeType()
236
237
* @param array $actualResponse
237
238
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
238
239
*/
239
- private function assertAttributeType (
240
+ private function assertComplexAttributeType (
240
241
$ attributeTypes ,
241
242
$ expectedAttributeCodes ,
242
243
$ entityTypes ,
@@ -283,4 +284,34 @@ private function assertAttributeType(
283
284
284
285
}
285
286
}
287
+
288
+ /**
289
+ * @param array $attributeTypes
290
+ * @param array $expectedAttributeCodes
291
+ * @param array $entityTypes
292
+ * @param array $inputTypes
293
+ * @param array $actualResponse
294
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
295
+ */
296
+ private function assertAttributeType (
297
+ $ attributeTypes ,
298
+ $ expectedAttributeCodes ,
299
+ $ entityTypes ,
300
+ $ inputTypes ,
301
+ $ actualResponse
302
+ ) {
303
+ $ attributeMetaDataItems = array_map (null , $ actualResponse ['customAttributeMetadata ' ]['items ' ], $ attributeTypes );
304
+
305
+ foreach ($ attributeMetaDataItems as $ itemIndex => $ itemArray ) {
306
+ $ this ->assertResponseFields (
307
+ $ attributeMetaDataItems [$ itemIndex ][0 ],
308
+ [
309
+ "attribute_code " => $ expectedAttributeCodes [$ itemIndex ],
310
+ "attribute_type " => $ attributeTypes [$ itemIndex ],
311
+ "entity_type " => $ entityTypes [$ itemIndex ],
312
+ "input_type " => $ inputTypes [$ itemIndex ]
313
+ ]
314
+ );
315
+ }
316
+ }
286
317
}
0 commit comments