@@ -75,25 +75,16 @@ public function testGetNestedOptionsCustomAttributesMetadata()
75
75
public function testGetCustomAttributesMetadataWithAttributeNamedCustomAttribute ()
76
76
{
77
77
$ customAttributesMetadata = $ this ->_service ->getCustomAttributesMetadata ();
78
- $ customAttributeCodeOne = 'custom_attribute1 ' ;
79
- $ customAttributeFound = false ;
80
- $ customAttributeCodeTwo = 'custom_attribute2 ' ;
81
- $ customAttributesFound = false ;
78
+ $ expectedCustomAttributeCodeArray = ['custom_attribute1 ' , 'custom_attribute2 ' , 'customer_image ' ];
79
+ $ actual = [];
82
80
foreach ($ customAttributesMetadata as $ attribute ) {
83
- if ($ attribute ->getAttributeCode () == $ customAttributeCodeOne ) {
84
- $ customAttributeFound = true ;
85
- }
86
- if ($ attribute ->getAttributeCode () == $ customAttributeCodeTwo ) {
87
- $ customAttributesFound = true ;
88
- }
89
- }
90
- if (!$ customAttributeFound ) {
91
- $ this ->fail ("Custom attribute declared in the config not found. " );
81
+ $ actual [] = $ attribute ->getAttributeCode ();
92
82
}
93
- if (!$ customAttributesFound ) {
94
- $ this ->fail ("Custom attributes declared in the config not found. " );
95
- }
96
- $ this ->assertCount (3 , $ customAttributesMetadata , "Invalid number of attributes returned. " );
83
+ $ this ->assertEquals (
84
+ $ expectedCustomAttributeCodeArray ,
85
+ array_intersect ($ expectedCustomAttributeCodeArray , $ actual ),
86
+ "Expected attributes not returned from the service. "
87
+ );
97
88
}
98
89
99
90
/**
0 commit comments