objectManagerHelper = new ObjectManagerHelper($this); $this->actions = $this->objectManagerHelper->getObject(\Magento\Rule\Model\Renderer\Actions::class); $this->_element = $this->createPartialMock( \Magento\Framework\Data\Form\Element\AbstractElement::class, ['getRule'] ); } public function testRender() { $rule = $this->getMockBuilder(\Magento\Rule\Model\AbstractModel::class) ->setMethods(['getActions', '__sleep', '__wakeup']) ->disableOriginalConstructor() ->getMockForAbstractClass(); $actions = $this->createPartialMock(\Magento\Rule\Model\Action\Collection::class, ['asHtmlRecursive']); $this->_element->expects($this->any()) ->method('getRule') ->will($this->returnValue($rule)); $rule->expects($this->any()) ->method('getActions') ->will($this->returnValue($actions)); $actions->expects($this->once()) ->method('asHtmlRecursive') ->will($this->returnValue('action html')); $this->assertEquals('action html', $this->actions->render($this->_element)); } }