64 $this->configMock = $this->createMock(\
Magento\Framework\View\Page\Config::class);
66 $this->createMock(\
Magento\Multishipping\Model\Checkout\Type\Multishipping::class);
67 $this->titleMock = $this->createMock(\
Magento\Framework\View\Page\Title::class);
68 $this->layoutMock = $this->createMock(\
Magento\Framework\View\Layout::class);
69 $this->viewMock = $this->createMock(\
Magento\Framework\
App\ViewInterface::class);
70 $this->request = $this->getMockBuilder(\
Magento\Framework\
App\RequestInterface::class)
71 ->disableOriginalConstructor()
73 ->getMockForAbstractClass();
75 ->disableOriginalConstructor()
77 ->getMockForAbstractClass();
78 $contextMock = $this->createMock(\
Magento\Framework\
App\Action\Context::class);
79 $contextMock->expects($this->atLeastOnce())
80 ->method(
'getRequest')
81 ->will($this->returnValue($this->request));
82 $contextMock->expects($this->atLeastOnce())
83 ->method(
'getResponse')
85 $contextMock->expects($this->any())->method(
'getView')->willReturn($this->viewMock);
86 $methods = [
'setTitle',
'getTitle',
'setSuccessUrl',
'setBackUrl',
'setErrorUrl',
'__wakeUp'];
87 $this->addressFormMock =
88 $this->createPartialMock(\
Magento\Customer\Block\Address\Edit::class,
$methods);
89 $this->urlMock = $this->createMock(\
Magento\Framework\UrlInterface::class);
90 $contextMock->expects($this->any())->method(
'getUrl')->willReturn($this->urlMock);
91 $this->pageMock = $this->createMock(\
Magento\Framework\View\Result\Page::class);
92 $this->pageMock->expects($this->any())->method(
'getConfig')->willReturn($this->configMock);
93 $this->configMock->expects($this->any())->method(
'getTitle')->willReturn($this->titleMock);
94 $this->viewMock->expects($this->any())->method(
'getPage')->willReturn($this->pageMock);
96 \
Magento\Multishipping\Controller\Checkout\Address\EditAddress::class,
97 [
'context' => $contextMock]
103 $this->viewMock->expects($this->once())->method(
'loadLayout')->willReturnSelf();
104 $this->request->expects($this->once())->method(
'getParam')->with(
'id')->willReturn(1);
105 $this->viewMock->expects($this->any())->method(
'getLayout')->willReturn($this->layoutMock);
107 ->expects($this->once())
109 ->with(
'customer_address_edit')
110 ->willReturn($this->addressFormMock);
111 $this->addressFormMock
112 ->expects($this->once())
114 ->with(
'Edit Address')
116 $helperMock = $this->createPartialMock(\
Magento\Multishipping\Helper\Data::class, [
'__']);
117 $helperMock->expects($this->any())->method(
'__')->willReturn(
'Edit Address');
119 [
'*/*/selectBilling',
null,
'success/url'],
120 [
'*/*/*', [
'id' => 1],
'error/url'],
122 $this->urlMock->expects($this->any())->method(
'getUrl')->willReturnMap($valueMap);
123 $this->addressFormMock->expects($this->once())->method(
'setSuccessUrl')->with(
'success/url')->willReturnSelf();
124 $this->addressFormMock->expects($this->once())->method(
'setErrorUrl')->with(
'error/url')->willReturnSelf();
126 $this->titleMock->expects($this->once())->method(
'getDefault')->willReturn(
'default_title');
127 $this->addressFormMock->expects($this->once())->method(
'getTitle')->willReturn(
'Address title');
128 $this->titleMock->expects($this->once())->method(
'set')->with(
'Address title - default_title');
129 $this->addressFormMock->expects($this->once())->method(
'setBackUrl')->with(
'success/url');
130 $this->viewMock->expects($this->once())->method(
'renderLayout');
131 $this->controller->execute();
136 $this->viewMock->expects($this->once())->method(
'loadLayout')->willReturnSelf();
137 $this->viewMock->expects($this->any())->method(
'getLayout')->willReturn($this->layoutMock);
139 ->expects($this->once())
141 ->with(
'customer_address_edit');
142 $this->urlMock->expects($this->never())->method(
'getUrl');
143 $this->viewMock->expects($this->once())->method(
'renderLayout');
144 $this->controller->execute();
testExecuteWhenCustomerAddressBlockNotExist()