Skip to content

Commit 82c8402

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

File tree

2 files changed

+38
-17
lines changed

2 files changed

+38
-17
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/**
1414
* Import entity abstract product type model
1515
*
16+
* phpcs:disable Magento2.Classes.AbstractApi
1617
* @api
1718
*
1819
* @SuppressWarnings(PHPMD.TooManyFields)

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

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ protected function setUp()
7272
'setAttributeSetFilter'
7373
]
7474
);
75-
$attribute = $this->createPartialMock(\Magento\Eav\Model\Entity\Attribute::class, [
75+
$attribute = $this->createPartialMock(
76+
\Magento\Eav\Model\Entity\Attribute::class,
77+
[
7678
'getAttributeCode',
7779
'getId',
7880
'getIsVisible',
@@ -85,7 +87,8 @@ protected function setUp()
8587
'getDefaultValue',
8688
'usesSource',
8789
'getFrontendInput',
88-
]);
90+
]
91+
);
8992
$attribute->expects($this->any())->method('getIsVisible')->willReturn(true);
9093
$attribute->expects($this->any())->method('getIsGlobal')->willReturn(true);
9194
$attribute->expects($this->any())->method('getIsRequired')->willReturn(true);
@@ -167,21 +170,27 @@ protected function setUp()
167170
)
168171
->willReturn([$attribute1, $attribute2, $attribute3]);
169172

170-
$this->connection = $this->createPartialMock(\Magento\Framework\DB\Adapter\Pdo\Mysql::class, [
173+
$this->connection = $this->createPartialMock(
174+
\Magento\Framework\DB\Adapter\Pdo\Mysql::class,
175+
[
171176
'select',
172177
'fetchAll',
173178
'fetchPairs',
174179
'joinLeft',
175180
'insertOnDuplicate',
176181
'delete',
177182
'quoteInto'
178-
]);
179-
$this->select = $this->createPartialMock(\Magento\Framework\DB\Select::class, [
183+
]
184+
);
185+
$this->select = $this->createPartialMock(
186+
\Magento\Framework\DB\Select::class,
187+
[
180188
'from',
181189
'where',
182190
'joinLeft',
183191
'getConnection',
184-
]);
192+
]
193+
);
185194
$this->select->expects($this->any())->method('from')->will($this->returnSelf());
186195
$this->select->expects($this->any())->method('where')->will($this->returnSelf());
187196
$this->select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
@@ -197,10 +206,13 @@ protected function setUp()
197206
->method('fetchAll')
198207
->will($this->returnValue($entityAttributes));
199208

200-
$this->resource = $this->createPartialMock(\Magento\Framework\App\ResourceConnection::class, [
209+
$this->resource = $this->createPartialMock(
210+
\Magento\Framework\App\ResourceConnection::class,
211+
[
201212
'getConnection',
202213
'getTableName',
203-
]);
214+
]
215+
);
204216
$this->resource->expects($this->any())->method('getConnection')->will(
205217
$this->returnValue($this->connection)
206218
);
@@ -265,9 +277,13 @@ public function testIsRowValidSuccess()
265277
$rowNum = 1;
266278
$this->entityModel->expects($this->any())->method('getRowScope')->willReturn(null);
267279
$this->entityModel->expects($this->never())->method('addRowError');
268-
$this->setPropertyValue($this->simpleType, '_attributes', [
269-
$rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => [],
270-
]);
280+
$this->setPropertyValue(
281+
$this->simpleType,
282+
'_attributes',
283+
[
284+
$rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => [],
285+
]
286+
);
271287
$this->assertTrue($this->simpleType->isRowValid($rowData, $rowNum));
272288
}
273289

@@ -286,13 +302,17 @@ public function testIsRowValidError()
286302
'attr_code'
287303
)
288304
->willReturnSelf();
289-
$this->setPropertyValue($this->simpleType, '_attributes', [
290-
$rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => [
291-
'attr_code' => [
292-
'is_required' => true,
305+
$this->setPropertyValue(
306+
$this->simpleType,
307+
'_attributes',
308+
[
309+
$rowData[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => [
310+
'attr_code' => [
311+
'is_required' => true,
312+
],
293313
],
294-
],
295-
]);
314+
]
315+
);
296316

297317
$this->assertFalse($this->simpleType->isRowValid($rowData, $rowNum));
298318
}

0 commit comments

Comments
 (0)