Skip to content

Commit 20f138c

Browse files
committed
MC-38546: Warnings in Unit tests build log
1 parent 73b9506 commit 20f138c

File tree

1 file changed

+4
-8
lines changed
  • app/code/Magento/Catalog/Test/Unit/Model/Product/Type

1 file changed

+4
-8
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function setUp(): void
111111
$this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup')
112112
->willReturn($group);
113113
$this->tierPriceExtensionFactoryMock = $this->getMockBuilder(ProductTierPriceExtensionFactory::class)
114-
->setMethods(['create'])
114+
->onlyMethods(['create'])
115115
->disableOriginalConstructor()
116116
->getMock();
117117
$this->model = $this->objectManagerHelper->getObject(
@@ -183,9 +183,7 @@ function () {
183183
);
184184

185185
// create sample TierPrice objects that would be coming from a REST call
186-
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
187-
->setMethods(['getWebsiteId', 'setWebsiteId', 'getPercentageValue', 'setPercentageValue'])
188-
->getMockForAbstractClass();
186+
$tierPriceExtensionMock = $this->getProductTierPriceExtensionInterfaceMock();
189187
$tierPriceExtensionMock->expects($this->any())->method('getWebsiteId')->willReturn($expectedWebsiteId);
190188
$tierPriceExtensionMock->expects($this->any())->method('getPercentageValue')->willReturn(null);
191189
$tp1 = $this->objectManagerHelper->getObject(TierPrice::class);
@@ -227,9 +225,7 @@ function () {
227225
$this->assertEquals($tps[$i]->getQty(), $tpData['price_qty'], 'Qty does not match');
228226
}
229227

230-
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
231-
->setMethods(['getWebsiteId', 'setWebsiteId', 'getPercentageValue', 'setPercentageValue'])
232-
->getMockForAbstractClass();
228+
$tierPriceExtensionMock = $this->getProductTierPriceExtensionInterfaceMock();
233229
$tierPriceExtensionMock->expects($this->any())->method('getPercentageValue')->willReturn(50);
234230
$tierPriceExtensionMock->expects($this->any())->method('setWebsiteId');
235231
$this->tierPriceExtensionFactoryMock->expects($this->any())
@@ -309,7 +305,7 @@ private function getProductTierPriceExtensionInterfaceMock(): MockObject
309305
$mockBuilder = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
310306
->disableOriginalConstructor();
311307
try {
312-
$mockBuilder->addMethods(['getPercentageValue', 'setPercentageValue', 'setWebsiteId']);
308+
$mockBuilder->addMethods(['getPercentageValue', 'setPercentageValue', 'setWebsiteId', 'getWebsiteId']);
313309
} catch (RuntimeException $e) {
314310
// ProductTierPriceExtensionInterface already generated and has all necessary methods.
315311
}

0 commit comments

Comments
 (0)