Skip to content

Commit 67318e7

Browse files
MAGETWO-71432: Add cast to string for CUST_GROUP_ALL #10475
2 parents 2b48dfe + 009ae2f commit 67318e7

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

app/code/Magento/Customer/Model/Customer/Source/Group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function toOptionArray()
5656
$customerGroups = [];
5757
$customerGroups[] = [
5858
'label' => __('ALL GROUPS'),
59-
'value' => GroupInterface::CUST_GROUP_ALL,
59+
'value' => (string)GroupInterface::CUST_GROUP_ALL,
6060
];
6161

6262
/** @var GroupSearchResultsInterface $groups */

app/code/Magento/Customer/Test/Unit/Model/Customer/Source/GroupTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ protected function setUp()
7171
public function testToOptionArray()
7272
{
7373
$customerGroups = [
74-
['label' => __('ALL GROUPS'), 'value' => 32000],
75-
['label' => __('NOT LOGGED IN'), 'value' => 0]
74+
['label' => __('ALL GROUPS'), 'value' => '32000'],
75+
['label' => __('NOT LOGGED IN'), 'value' => '0'],
7676
];
7777

7878
$this->moduleManagerMock->expects($this->any())
@@ -95,11 +95,17 @@ public function testToOptionArray()
9595
->setMethods(['getCode', 'getId'])
9696
->getMockForAbstractClass();
9797
$groupTest->expects($this->any())->method('getCode')->willReturn(__('NOT LOGGED IN'));
98-
$groupTest->expects($this->any())->method('getId')->willReturn(0);
98+
$groupTest->expects($this->any())->method('getId')->willReturn('0');
9999
$groups = [$groupTest];
100100

101101
$this->searchResultMock->expects($this->any())->method('getItems')->willReturn($groups);
102102

103-
$this->assertEquals($customerGroups, $this->model->toOptionArray());
103+
$actualCustomerGroups = $this->model->toOptionArray();
104+
105+
$this->assertEquals($customerGroups, $actualCustomerGroups);
106+
107+
foreach ($actualCustomerGroups as $actualCustomerGroup) {
108+
$this->assertInternalType('string', $actualCustomerGroup['value']);
109+
}
104110
}
105111
}

0 commit comments

Comments
 (0)