objectManagerHelper = new ObjectManagerHelper($this); $this->conditions = $this->objectManagerHelper->getObject(\Magento\Rule\Model\Renderer\Conditions::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(['getConditions', '__sleep', '__wakeup']) ->disableOriginalConstructor() ->getMockForAbstractClass(); $conditions = $this->createPartialMock(\Magento\Rule\Model\Condition\Combine::class, ['asHtmlRecursive']); $this->_element->expects($this->any()) ->method('getRule') ->will($this->returnValue($rule)); $rule->expects($this->any()) ->method('getConditions') ->will($this->returnValue($conditions)); $conditions->expects($this->once()) ->method('asHtmlRecursive') ->will($this->returnValue('conditions html')); $this->assertEquals('conditions html', $this->conditions->render($this->_element)); } }