Skip to content

Commit 9a81af0

Browse files
committed
MC-33069: Stabilize Unit tests
1 parent 431a535 commit 9a81af0

File tree

1 file changed

+13
-4
lines changed
  • app/code/Magento/GroupedImportExport/Test/Unit/Model/Import/Product/Type/Grouped

1 file changed

+13
-4
lines changed

app/code/Magento/GroupedImportExport/Test/Unit/Model/Import/Product/Type/Grouped/LinksTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,25 @@ public function testSaveLinksDataWithProductsAttrs($linksData)
108108
$linksData['attr_product_ids'] = [12 => true, 16 => true];
109109
$linksData['position'] = [4 => 6];
110110
$linksData['qty'] = [9 => 3];
111+
$attributes = [
112+
['id' => 1, 'code' => 'position', 'type' => 'int'],
113+
['id' => 2, 'code' => 'qty', 'type' => 'decimal'],
114+
];
111115
$this->processBehaviorGetter('append');
112116
$select = $this->createMock(Select::class);
113-
$this->connection->expects($this->any())->method('select')->will($this->returnValue($select));
114-
$select->expects($this->any())->method('from')->willReturnSelf();
115-
$select->expects($this->any())->method('where')->willReturnSelf();
116-
$this->connection->expects($this->once())->method('fetchAll')->with($select)->will($this->returnValue([]));
117+
$this->connection->expects($this->exactly(2))->method('select')->will($this->returnValue($select));
118+
$select->expects($this->exactly(2))->method('from')->willReturnSelf();
119+
$select->expects($this->exactly(2))->method('where')->willReturnSelf();
120+
$this->connection->expects($this->once())->method('fetchAll')
121+
->with($select)->will($this->returnValue($attributes));
117122
$this->connection->expects($this->once())->method('fetchPairs')->with($select)->will(
118123
$this->returnValue([])
119124
);
120125
$this->connection->expects($this->exactly(4))->method('insertOnDuplicate');
126+
$this->link->expects($this->exactly(2))->method('getAttributeTypeTable')->willReturn(
127+
'table_name'
128+
);
129+
121130
$this->links->saveLinksData($linksData);
122131
}
123132

0 commit comments

Comments
 (0)