objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->actionFactory = $this->objectManagerHelper->getObject( \Magento\Rule\Model\ActionFactory::class, [ 'objectManager' => $this->objectManagerMock ] ); } public function testCreate() { $type = '1'; $data = ['data2', 'data3']; $this->objectManagerMock->expects($this->once())->method('create')->with($type, $data); $this->actionFactory->create($type, $data); } }