@@ -111,7 +111,7 @@ protected function setUp(): void
111
111
$ this ->groupManagementMock ->expects ($ this ->any ())->method ('getAllCustomersGroup ' )
112
112
->willReturn ($ group );
113
113
$ this ->tierPriceExtensionFactoryMock = $ this ->getMockBuilder (ProductTierPriceExtensionFactory::class)
114
- ->setMethods (['create ' ])
114
+ ->onlyMethods (['create ' ])
115
115
->disableOriginalConstructor ()
116
116
->getMock ();
117
117
$ this ->model = $ this ->objectManagerHelper ->getObject (
@@ -183,9 +183,7 @@ function () {
183
183
);
184
184
185
185
// 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 ();
189
187
$ tierPriceExtensionMock ->expects ($ this ->any ())->method ('getWebsiteId ' )->willReturn ($ expectedWebsiteId );
190
188
$ tierPriceExtensionMock ->expects ($ this ->any ())->method ('getPercentageValue ' )->willReturn (null );
191
189
$ tp1 = $ this ->objectManagerHelper ->getObject (TierPrice::class);
@@ -227,9 +225,7 @@ function () {
227
225
$ this ->assertEquals ($ tps [$ i ]->getQty (), $ tpData ['price_qty ' ], 'Qty does not match ' );
228
226
}
229
227
230
- $ tierPriceExtensionMock = $ this ->getMockBuilder (ProductTierPriceExtensionInterface::class)
231
- ->setMethods (['getWebsiteId ' , 'setWebsiteId ' , 'getPercentageValue ' , 'setPercentageValue ' ])
232
- ->getMockForAbstractClass ();
228
+ $ tierPriceExtensionMock = $ this ->getProductTierPriceExtensionInterfaceMock ();
233
229
$ tierPriceExtensionMock ->expects ($ this ->any ())->method ('getPercentageValue ' )->willReturn (50 );
234
230
$ tierPriceExtensionMock ->expects ($ this ->any ())->method ('setWebsiteId ' );
235
231
$ this ->tierPriceExtensionFactoryMock ->expects ($ this ->any ())
@@ -309,7 +305,7 @@ private function getProductTierPriceExtensionInterfaceMock(): MockObject
309
305
$ mockBuilder = $ this ->getMockBuilder (ProductTierPriceExtensionInterface::class)
310
306
->disableOriginalConstructor ();
311
307
try {
312
- $ mockBuilder ->addMethods (['getPercentageValue ' , 'setPercentageValue ' , 'setWebsiteId ' ]);
308
+ $ mockBuilder ->addMethods (['getPercentageValue ' , 'setPercentageValue ' , 'setWebsiteId ' , ' getWebsiteId ' ]);
313
309
} catch (RuntimeException $ e ) {
314
310
// ProductTierPriceExtensionInterface already generated and has all necessary methods.
315
311
}
0 commit comments