@@ -151,7 +151,7 @@ protected function setUp(): void
151151 ->disableOriginalConstructor ()
152152 ->getMockForAbstractClass ();
153153 $ productExtensionAttributes = $ this ->getMockBuilder (ProductExtensionInterface::class)
154- ->onlyMethods (['getCategoryLinks ' , 'setCategoryLinks ' ])
154+ ->addMethods (['getCategoryLinks ' , 'setCategoryLinks ' ])
155155 ->getMockForAbstractClass ();
156156 $ this ->productMock ->setExtensionAttributes ($ productExtensionAttributes );
157157
@@ -184,7 +184,7 @@ protected function setUp(): void
184184 $ this ->customOptionFactoryMock
185185 ]
186186 ];
187- $ this ->prepareObjectManager ($ objects );
187+ $ this ->objectManager -> prepareObjectManager ($ objects );
188188
189189 $ this ->helper = $ this ->objectManager ->getObject (
190190 Helper::class,
@@ -772,22 +772,4 @@ private function assembleProductRepositoryMock($links)
772772 ->method ('getById ' )
773773 ->willReturnMap ($ repositoryReturnMap );
774774 }
775-
776- /**
777- * @param $map
778- */
779- private function prepareObjectManager ($ map )
780- {
781- $ objectManagerMock = $ this ->getMockBuilder (ObjectManagerInterface::class)
782- ->addMethods (['getInstance ' ])
783- ->onlyMethods (['get ' ])
784- ->getMockForAbstractClass ();
785-
786- $ objectManagerMock ->method ('getInstance ' )->willReturnSelf ();
787- $ objectManagerMock ->method ('get ' )->willReturnMap ($ map );
788-
789- $ reflectionProperty = new \ReflectionProperty (\Magento \Framework \App \ObjectManager::class, '_instance ' );
790- $ reflectionProperty ->setAccessible (true );
791- $ reflectionProperty ->setValue ($ objectManagerMock , $ objectManagerMock );
792- }
793775}
0 commit comments