79 $this->configMock = $this->createMock(\
Magento\Framework\View\Page\Config::class);
81 $this->createMock(\
Magento\Multishipping\Model\Checkout\Type\Multishipping::class);
82 $this->titleMock = $this->createMock(\
Magento\Framework\View\Page\Title::class);
83 $this->layoutMock = $this->createMock(\
Magento\Framework\View\Layout::class);
84 $this->viewMock = $this->createMock(\
Magento\Framework\
App\ViewInterface::class);
85 $this->objectManagerMock = $this->createMock(\
Magento\Framework\ObjectManagerInterface::class);
87 $this->createMock(\
Magento\Multishipping\Model\Checkout\Type\Multishipping\State::class);
89 [\Magento\Multishipping\Model\Checkout\Type\Multishipping\State::class,
$this->stateMock],
92 $this->objectManagerMock->expects($this->any())->method(
'get')->willReturnMap($valueMap);
93 $this->request = $this->getMockBuilder(\
Magento\Framework\
App\RequestInterface::class)
94 ->disableOriginalConstructor()
96 ->getMockForAbstractClass();
98 ->disableOriginalConstructor()
100 ->getMockForAbstractClass();
101 $contextMock = $this->createMock(\
Magento\Framework\
App\Action\Context::class);
102 $contextMock->expects($this->atLeastOnce())
103 ->method(
'getRequest')
104 ->will($this->returnValue($this->request));
105 $contextMock->expects($this->atLeastOnce())
106 ->method(
'getResponse')
108 $contextMock->expects($this->any())->method(
'getView')->willReturn($this->viewMock);
109 $contextMock->expects($this->any())->method(
'getObjectManager')->willReturn($this->objectManagerMock);
110 $methods = [
'setTitle',
'getTitle',
'setSuccessUrl',
'setBackUrl',
'setErrorUrl',
'__wakeUp'];
111 $this->addressFormMock =
112 $this->createPartialMock(\
Magento\Customer\Block\Address\Edit::class,
$methods);
113 $this->urlMock = $this->createMock(\
Magento\Framework\UrlInterface::class);
114 $contextMock->expects($this->any())->method(
'getUrl')->willReturn($this->urlMock);
115 $this->pageMock = $this->createMock(\
Magento\Framework\View\Result\Page::class);
116 $this->pageMock->expects($this->any())->method(
'getConfig')->willReturn($this->configMock);
117 $this->configMock->expects($this->any())->method(
'getTitle')->willReturn($this->titleMock);
118 $this->viewMock->expects($this->any())->method(
'getPage')->willReturn($this->pageMock);
120 \
Magento\Multishipping\Controller\Checkout\Address\EditBilling::class,
121 [
'context' => $contextMock]
128 ->expects($this->once())
129 ->method(
'setActiveStep')
130 ->with(\
Magento\Multishipping\Model\Checkout\Type\Multishipping\State::STEP_BILLING);
131 $this->request->expects($this->once())->method(
'getParam')->with(
'id')->willReturn(1);
132 $this->viewMock->expects($this->once())->method(
'loadLayout')->willReturnSelf();
133 $this->viewMock->expects($this->any())->method(
'getLayout')->willReturn($this->layoutMock);
135 ->expects($this->once())
137 ->with(
'customer_address_edit')
138 ->willReturn($this->addressFormMock);
139 $this->addressFormMock
140 ->expects($this->once())
142 ->with(
'Edit Billing Address')
144 $helperMock = $this->createPartialMock(\
Magento\Multishipping\Helper\Data::class, [
'__']);
145 $helperMock->expects($this->any())->method(
'__')->willReturn(
'Edit Billing Address');
146 $this->addressFormMock->expects($this->once())->method(
'setSuccessUrl')->with(
'success/url')->willReturnSelf();
147 $this->addressFormMock->expects($this->once())->method(
'setErrorUrl')->with(
'error/url')->willReturnSelf();
149 [
'*/*/saveBilling', [
'id' => 1],
'success/url'],
150 [
'*/*/*', [
'id' => 1],
'error/url'],
151 [
'*/checkout/overview',
null,
'back/address']
153 $this->urlMock->expects($this->any())->method(
'getUrl')->willReturnMap($valueMap);
154 $this->titleMock->expects($this->once())->method(
'getDefault')->willReturn(
'default_title');
155 $this->addressFormMock->expects($this->once())->method(
'getTitle')->willReturn(
'Address title');
156 $this->titleMock->expects($this->once())->method(
'set')->with(
'Address title - default_title');
157 $this->addressFormMock->expects($this->once())->method(
'setBackUrl')->with(
'back/address');
158 $this->viewMock->expects($this->once())->method(
'renderLayout');
159 $this->controller->execute();
165 ->expects($this->once())
166 ->method(
'setActiveStep')
167 ->with(\
Magento\Multishipping\Model\Checkout\Type\Multishipping\State::STEP_BILLING);
168 $this->viewMock->expects($this->once())->method(
'loadLayout')->willReturnSelf();
169 $this->viewMock->expects($this->any())->method(
'getLayout')->willReturn($this->layoutMock);
171 ->expects($this->once())
173 ->with(
'customer_address_edit');
174 $this->urlMock->expects($this->never())->method(
'getUrl');
175 $this->viewMock->expects($this->once())->method(
'renderLayout');
176 $this->controller->execute();
testExecuteWhenCustomerAddressBlockNotExist()