@@ -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