Skip to content

Commit d752b1b

Browse files
author
Sergii Kovalenko
committed
MAGETWO-69521: Customer attribute with "Show on Storefront" set to No does not appear in backend
1 parent 38970f8 commit d752b1b

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -338,20 +338,16 @@ protected function getTypeAddressMock()
338338
return $typeAddressMock;
339339
}
340340

341+
/**
342+
* @param \PHPUnit_Framework_MockObject_MockObject $attributeMock
343+
* @param \PHPUnit_Framework_MockObject_MockObject $attributeBooleanMock
344+
* @param array $options
345+
*/
341346
private function injectVisibilityProps(
342347
\PHPUnit_Framework_MockObject_MockObject $attributeMock,
343348
\PHPUnit_Framework_MockObject_MockObject $attributeBooleanMock,
344349
array $options = []
345350
) {
346-
$attributeCode = self::ATTRIBUTE_CODE;
347-
if (isset($options[self::ATTRIBUTE_CODE]['specific_code_prefix'])) {
348-
$attributeCode = $attributeCode . $options[self::ATTRIBUTE_CODE]['specific_code_prefix'];
349-
}
350-
351-
$attributeMock->expects($this->exactly(2))
352-
->method('getAttributeCode')
353-
->willReturn($attributeCode);
354-
355351
if (isset($options[self::ATTRIBUTE_CODE]['visible'])) {
356352
$attributeMock->expects($this->any())
357353
->method('getIsVisible')
@@ -370,15 +366,6 @@ private function injectVisibilityProps(
370366
->willReturn($options[self::ATTRIBUTE_CODE]['is_used_in_forms']);
371367
}
372368

373-
$booleanAttributeCode = 'test-code-boolean';
374-
if (isset($options['test-code-boolean']['specific_code_prefix'])) {
375-
$booleanAttributeCode = $booleanAttributeCode . $options['test-code-boolean']['specific_code_prefix'];
376-
}
377-
378-
$attributeBooleanMock->expects($this->exactly(2))
379-
->method('getAttributeCode')
380-
->willReturn($booleanAttributeCode);
381-
382369
if (isset($options['test-code-boolean']['visible'])) {
383370
$attributeBooleanMock->expects($this->any())
384371
->method('getIsVisible')
@@ -423,6 +410,15 @@ protected function getAttributeMock($type = 'customer', $options = [])
423410
->disableOriginalConstructor()
424411
->getMockForAbstractClass();
425412

413+
$attributeCode = self::ATTRIBUTE_CODE;
414+
if (isset($options[self::ATTRIBUTE_CODE]['specific_code_prefix'])) {
415+
$attributeCode = $attributeCode . $options[self::ATTRIBUTE_CODE]['specific_code_prefix'];
416+
}
417+
418+
$attributeMock->expects($this->exactly(2))
419+
->method('getAttributeCode')
420+
->willReturn($attributeCode);
421+
426422
$sourceMock->expects($this->any())
427423
->method('getAllOptions')
428424
->willReturn(self::OPTIONS_RESULT);
@@ -473,6 +469,14 @@ function ($origName) {
473469
$attributeBooleanMock->expects($this->once())
474470
->method('usesSource')
475471
->willReturn(false);
472+
$booleanAttributeCode = 'test-code-boolean';
473+
if (isset($options['test-code-boolean']['specific_code_prefix'])) {
474+
$booleanAttributeCode = $booleanAttributeCode . $options['test-code-boolean']['specific_code_prefix'];
475+
}
476+
477+
$attributeBooleanMock->expects($this->exactly(2))
478+
->method('getAttributeCode')
479+
->willReturn($booleanAttributeCode);
476480

477481
$this->eavValidationRulesMock->expects($this->any())
478482
->method('build')

0 commit comments

Comments
 (0)