Skip to content

Commit ff576d2

Browse files
author
Dmitry Kologrivov
committed
MAGNIMEX-156: Fix bug
1 parent c181df2 commit ff576d2

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,12 @@ protected function setUp()
204204
'',
205205
false
206206
);
207-
$this->_setColFactory = $this->getMock(
208-
'\Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory',
209-
['create'],
207+
$this->attrSetColFactory = $this->getMock(
208+
'Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory',
209+
[
210+
'create',
211+
'setEntityTypeFilter',
212+
],
210213
[],
211214
'',
212215
false
@@ -327,7 +330,7 @@ protected function setUp()
327330
$this->collection,
328331
$this->exportConfig,
329332
$this->productFactory,
330-
$this->_setColFactory,
333+
$this->attrSetColFactory,
331334
$this->categoryColFactory,
332335
$this->itemFactory,
333336
$this->optionColFactory,
@@ -379,23 +382,25 @@ public function testExportCurPageEqualToLastBreakInternalCalls()
379382
$this->abstractCollection->expects($this->once())->method('getCurPage')->willReturn($curPage);
380383
$this->abstractCollection->expects($this->once())->method('getLastPageNumber')->willReturn($lastPage);
381384
$headers = ['headers'];
382-
$this->advancedPricing->expects($this->once())->method('_getHeaderColumns')->willReturn($headers);
383-
$this->writer->expects($this->once())->method('setHeaderCols')->with($headers);
385+
$this->advancedPricing->expects($this->any())->method('_getHeaderColumns')->willReturn($headers);
386+
$this->writer->expects($this->any())->method('setHeaderCols')->with($headers);
387+
$webSite = 'All Websites [USD]';
388+
$userGroup = 'General';
389+
$this->advancedPricing->expects($this->any())->method('_getWebsiteCode')->willReturn($webSite);
390+
$this->advancedPricing->expects($this->any())->method('_getCustomerGroupById')->willReturn($userGroup);
384391
$data = [
385-
'sku' => 'simpletest',
386-
'group_price_website' => '0',
387-
'group_price_customer_group' => '1',
388-
'group_price' => '100',
389-
'tier_price_website' => '0',
390-
'tier_price_customer_group' => '2',
391-
'tier_price_qty' => '2',
392-
'tier_price' => '23',
392+
[
393+
'sku' => 'simpletest',
394+
'group_price_website' => $webSite,
395+
'group_price_customer_group' => $userGroup,
396+
'group_price' => '100',
397+
'tier_price_website' => $webSite,
398+
'tier_price_customer_group' => $userGroup,
399+
'tier_price_qty' => '2',
400+
'tier_price' => '23',
401+
]
393402
];
394403
$this->advancedPricing->expects($this->once())->method('getExportData')->willReturn($data);
395-
$webSite = 'All Websites [USD]';
396-
$userGroup = 'General';
397-
$this->advancedPricing->expects($this->once())->method('_getWebsiteCode')->willReturn($webSite);
398-
$this->advancedPricing->expects($this->once())->method('_getCustomerGroupById')->willReturn($userGroup);
399404
$exportData = [
400405
'sku' => 'simpletest',
401406
'group_price_website' => $webSite,
@@ -406,6 +411,10 @@ public function testExportCurPageEqualToLastBreakInternalCalls()
406411
'tier_price_qty' => '2',
407412
'tier_price' => '23',
408413
];
414+
$this->advancedPricing
415+
->expects($this->any())
416+
->method('correctExportData')
417+
->willReturn($exportData);
409418
$this->writer->expects($this->once())->method('writeRow')->with($exportData);
410419
$this->writer->expects($this->once())->method('getContents');
411420
$this->advancedPricing->export();

0 commit comments

Comments
 (0)