@@ -151,7 +151,7 @@ protected function setUp(): void
151
151
->disableOriginalConstructor ()
152
152
->getMockForAbstractClass ();
153
153
$ productExtensionAttributes = $ this ->getMockBuilder (ProductExtensionInterface::class)
154
- ->onlyMethods (['getCategoryLinks ' , 'setCategoryLinks ' ])
154
+ ->addMethods (['getCategoryLinks ' , 'setCategoryLinks ' ])
155
155
->getMockForAbstractClass ();
156
156
$ this ->productMock ->setExtensionAttributes ($ productExtensionAttributes );
157
157
@@ -184,7 +184,7 @@ protected function setUp(): void
184
184
$ this ->customOptionFactoryMock
185
185
]
186
186
];
187
- $ this ->prepareObjectManager ($ objects );
187
+ $ this ->objectManager -> prepareObjectManager ($ objects );
188
188
189
189
$ this ->helper = $ this ->objectManager ->getObject (
190
190
Helper::class,
@@ -772,22 +772,4 @@ private function assembleProductRepositoryMock($links)
772
772
->method ('getById ' )
773
773
->willReturnMap ($ repositoryReturnMap );
774
774
}
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
- }
793
775
}
0 commit comments