Skip to content

Commit 8beac86

Browse files
author
Oleksandr Dubovyk
committed
MC-20112: [OnPrem] - Import CSV - Can't import empty value __EMPTY__VALUE__ at store view level
- modified test
1 parent a829df1 commit 8beac86

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/AbstractTypeTest.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ protected function setUp()
107107
];
108108
$attribute1 = clone $attribute;
109109
$attribute2 = clone $attribute;
110+
$attribute3 = clone $attribute;
110111

111112
$attribute1->expects($this->any())->method('getId')->willReturn('1');
112113
$attribute1->expects($this->any())->method('getAttributeCode')->willReturn('attr_code');
@@ -118,6 +119,11 @@ protected function setUp()
118119
$attribute2->expects($this->any())->method('getFrontendInput')->willReturn('boolean');
119120
$attribute2->expects($this->any())->method('isStatic')->willReturn(false);
120121

122+
$attribute3->expects($this->any())->method('getId')->willReturn('3');
123+
$attribute3->expects($this->any())->method('getAttributeCode')->willReturn('text_attribute');
124+
$attribute3->expects($this->any())->method('getFrontendInput')->willReturn('text');
125+
$attribute3->expects($this->any())->method('isStatic')->willReturn(false);
126+
121127
$this->entityModel->expects($this->any())->method('getEntityTypeId')->willReturn(3);
122128
$this->entityModel->expects($this->any())->method('getAttributeOptions')->willReturnOnConsecutiveCalls(
123129
['option1', 'option2'],
@@ -126,7 +132,9 @@ protected function setUp()
126132
$attrSetColFactory->expects($this->any())->method('create')->willReturn($attrSetCollection);
127133
$attrSetCollection->expects($this->any())->method('setEntityTypeFilter')->willReturn([$attributeSet]);
128134
$attrColFactory->expects($this->any())->method('create')->willReturn($attrCollection);
129-
$attrCollection->expects($this->any())->method('setAttributeSetFilter')->willReturn([$attribute1, $attribute2]);
135+
$attrCollection->expects($this->any())
136+
->method('setAttributeSetFilter')
137+
->willReturn([$attribute1, $attribute2, $attribute3]);
130138
$attributeSet->expects($this->any())->method('getId')->willReturn(1);
131139
$attributeSet->expects($this->any())->method('getAttributeSetName')->willReturn('attribute_set_name');
132140

@@ -157,7 +165,7 @@ protected function setUp()
157165
],
158166
]
159167
)
160-
->willReturn([$attribute1, $attribute2]);
168+
->willReturn([$attribute1, $attribute2, $attribute3]);
161169

162170
$this->connection = $this->createPartialMock(\Magento\Framework\DB\Adapter\Pdo\Mysql::class, [
163171
'select',
@@ -364,9 +372,14 @@ public function testPrepareAttributesWithDefaultValueForSave()
364372
{
365373
$rowData = [
366374
'_attribute_set' => 'attributeSetName',
367-
'boolean_attribute' => 'Yes'
375+
'boolean_attribute' => 'Yes',
376+
];
377+
378+
$expected = [
379+
'boolean_attribute' => 1,
380+
'text_attribute' => 'default_value'
368381
];
369382
$result = $this->simpleType->prepareAttributesWithDefaultValueForSave($rowData);
370-
$this->assertEquals(['boolean_attribute' => 1], $result);
383+
$this->assertEquals($expected, $result);
371384
}
372385
}

0 commit comments

Comments
 (0)