Skip to content

Commit bdfdd01

Browse files
committed
ACP2E-1345, avoid mocking deprecated classes
1 parent 3ddf576 commit bdfdd01

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

app/code/Magento/Bundle/Test/Unit/Model/ResourceModel/SelectionTest.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,29 @@ protected function setUp(): void
4040

4141
public function testSaveSelectionPrice()
4242
{
43-
$item = new Selection(
44-
$this->createMock(\Magento\Framework\Model\Context::class),
45-
$this->createMock(\Magento\Framework\Registry::class),
46-
$this->createMock(\Magento\Catalog\Helper\Data::class),
47-
$this->createMock(\Magento\Bundle\Model\ResourceModel\Selection::class)
48-
);
43+
$item = $this->getMockBuilder(Selection::class)
44+
->disableOriginalConstructor()
45+
->addMethods([
46+
'getSelectionId',
47+
'getWebsiteId',
48+
'getSelectionPriceType',
49+
'getSelectionPriceValue',
50+
'getParentProductId',
51+
'getDefaultPriceScope'])
52+
->getMock();
53+
$values = [
54+
'selection_id' => 1,
55+
'website_id' => 1,
56+
'selection_price_type' => null,
57+
'selection_price_value' => null,
58+
'parent_product_id' => 1,
59+
];
60+
$item->expects($this->once())->method('getDefaultPriceScope')->willReturn(false);
61+
$item->expects($this->once())->method('getSelectionId')->willReturn($values['selection_id']);
62+
$item->expects($this->once())->method('getWebsiteId')->willReturn($values['website_id']);
63+
$item->expects($this->once())->method('getSelectionPriceType')->willReturn($values['selection_price_type']);
64+
$item->expects($this->once())->method('getSelectionPriceValue')->willReturn($values['selection_price_value']);
65+
$item->expects($this->once())->method('getParentProductId')->willReturn($values['parent_product_id']);
4966

5067
$connection = $this->createMock(AdapterInterface::class);
5168
$connection->expects($this->once())

0 commit comments

Comments
 (0)