protected function setUp() { $this->contextMock = $this->getMock('Magento\\Backend\\Block\\Widget\\Context', [], [], '', false); $this->customerRegistryMock = $this->getMock('Magento\\Customer\\Model\\CustomerRegistry', ['retrieve'], [], '', false); $this->customerModelMock = $this->getMock('Magento\\Customer\\Model\\Customer', [], [], '', false); $this->registryMock = $this->getMock('Magento\\Framework\\Registry', ['registry'], [], '', false); $this->urlBuilderMock = $this->getMockBuilder('Magento\\Framework\\UrlInterface')->setMethods(['getUrl'])->disableOriginalConstructor()->getMockForAbstractClass(); $this->contextMock->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilderMock); $objectManagerHelper = new ObjectManagerHelper($this); $this->block = $objectManagerHelper->getObject('Magento\\Customer\\Block\\Adminhtml\\Edit\\UnlockButton', ['context' => $this->contextMock, 'customerRegistry' => $this->customerRegistryMock, 'urlBuilder' => $this->urlBuilderMock, 'registry' => $this->registryMock]); }
protected function initContext() { $this->urlBuilder = $this->getMockBuilder('Magento\\Framework\\UrlInterface')->disableOriginalConstructor()->getMock(); $this->context = $this->getMockBuilder('Magento\\Backend\\Block\\Widget\\Context')->disableOriginalConstructor()->getMock(); $this->context->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilder); }