Skip to content

Commit

Permalink
MAGETWO-80193: [2.2.x] - Add cast to string for CUST_GROUP_ALL #10475
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirZaets committed Oct 2, 2017
1 parent 29bc9ad commit 6c70c44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/Model/Customer/Source/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function toOptionArray()
$customerGroups = [];
$customerGroups[] = [
'label' => __('ALL GROUPS'),
'value' => GroupInterface::CUST_GROUP_ALL,
'value' => (string)GroupInterface::CUST_GROUP_ALL,
];

/** @var GroupSearchResultsInterface $groups */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ protected function setUp()
public function testToOptionArray()
{
$customerGroups = [
['label' => __('ALL GROUPS'), 'value' => 32000],
['label' => __('NOT LOGGED IN'), 'value' => 0]
['label' => __('ALL GROUPS'), 'value' => '32000'],
['label' => __('NOT LOGGED IN'), 'value' => '0'],
];

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

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

$this->assertEquals($customerGroups, $this->model->toOptionArray());
$actualCustomerGroups = $this->model->toOptionArray();

$this->assertEquals($customerGroups, $actualCustomerGroups);

foreach ($actualCustomerGroups as $actualCustomerGroup) {
$this->assertInternalType('string', $actualCustomerGroup['value']);
}
}
}
}

0 comments on commit 6c70c44

Please sign in to comment.