Skip to content

Commit 9c19879

Browse files
author
Yauhen_Lyskavets
committed
MAGETWO-91725: Reward Points Balance Update Emails are not being sent when balance change initiated by store front
- Bug fix - Integration test fix
1 parent 18f78d5 commit 9c19879

File tree

3 files changed

+32
-21
lines changed

3 files changed

+32
-21
lines changed

app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,26 @@ class CustomerMetadata implements CustomerMetadataInterface
3333
*/
3434
private $attributeMetadataDataProvider;
3535

36+
/**
37+
* List of system attributes which should be available to the clients.
38+
*
39+
* @var string[]
40+
*/
41+
private $systemAttributes;
42+
3643
/**
3744
* @param AttributeMetadataConverter $attributeMetadataConverter
3845
* @param AttributeMetadataDataProvider $attributeMetadataDataProvider
46+
* @param string[] $systemAttributes
3947
*/
4048
public function __construct(
4149
AttributeMetadataConverter $attributeMetadataConverter,
42-
AttributeMetadataDataProvider $attributeMetadataDataProvider
50+
AttributeMetadataDataProvider $attributeMetadataDataProvider,
51+
array $systemAttributes = []
4352
) {
4453
$this->attributeMetadataConverter = $attributeMetadataConverter;
4554
$this->attributeMetadataDataProvider = $attributeMetadataDataProvider;
55+
$this->systemAttributes = $systemAttributes;
4656
}
4757

4858
/**
@@ -136,25 +146,12 @@ public function getCustomAttributesMetadata($dataObjectClassName = self::DATA_IN
136146

137147
if (!$isDataObjectMethod
138148
&& (!$attributeMetadata->isSystem()
139-
|| in_array($attributeCode, $this->getAllowedSystemAttributesList())
149+
|| in_array($attributeCode, $this->systemAttributes)
140150
)
141151
) {
142152
$customAttributes[] = $attributeMetadata;
143153
}
144154
}
145155
return $customAttributes;
146156
}
147-
148-
/**
149-
* Get list of system attributes which should be available to the clients
150-
*
151-
* @return array
152-
*/
153-
private function getAllowedSystemAttributesList()
154-
{
155-
return [
156-
'disable_auto_group_change',
157-
'reward_update_notification'
158-
];
159-
}
160157
}

app/code/Magento/Customer/etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@
127127
<argument name="groupManagement" xsi:type="object">Magento\Customer\Api\GroupManagementInterface\Proxy</argument>
128128
</arguments>
129129
</type>
130+
<type name="Magento\Customer\Model\Metadata\CustomerMetadata">
131+
<arguments>
132+
<argument name="systemAttributes" xsi:type="array">
133+
<item name="disable_auto_group_change" xsi:type="string">disable_auto_group_change</item>
134+
</argument>
135+
</arguments>
136+
</type>
130137
<virtualType name="SectionInvalidationConfigReader" type="Magento\Framework\Config\Reader\Filesystem">
131138
<arguments>
132139
<argument name="idAttributes" xsi:type="array">

dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,23 @@ protected function setUp()
5151

5252
public function testGetCustomAttributesMetadata()
5353
{
54-
$customAttributesMetadata = $this->service->getCustomAttributesMetadata();
55-
$this->assertCount(0, $customAttributesMetadata, "Invalid number of attributes returned.");
54+
$customAttributesMetadataQty = count($this->service->getCustomAttributesMetadata()) ;
5655

5756
// Verify the consistency of getCustomerAttributeMetadata() function from the 2nd call of the same service
58-
$customAttributesMetadata1 = $this->service->getCustomAttributesMetadata();
59-
$this->assertCount(0, $customAttributesMetadata1, "Invalid number of attributes returned.");
57+
$customAttributesMetadata1Qty = count($this->service->getCustomAttributesMetadata());
58+
$this->assertEquals(
59+
$customAttributesMetadataQty,
60+
$customAttributesMetadata1Qty,
61+
"Invalid number of attributes returned."
62+
);
6063

6164
// Verify the consistency of getCustomAttributesMetadata() function from the 2nd service
62-
$customAttributesMetadata2 = $this->serviceTwo->getCustomAttributesMetadata();
63-
$this->assertCount(0, $customAttributesMetadata2, "Invalid number of attributes returned.");
65+
$customAttributesMetadata2Qty = count($this->serviceTwo->getCustomAttributesMetadata());
66+
$this->assertEquals(
67+
$customAttributesMetadataQty,
68+
$customAttributesMetadata2Qty,
69+
"Invalid number of attributes returned."
70+
);
6471
}
6572

6673
public function testGetNestedOptionsCustomerAttributesMetadata()

0 commit comments

Comments
 (0)