|
3 | 3 | * Copyright © 2015 Magento. All rights reserved.
|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
6 |
| - // @codingStandardsIgnoreFile |
7 | 6 |
|
8 | 7 | namespace Magento\Customer\Test\Unit\Controller\Adminhtml\Index;
|
9 | 8 |
|
@@ -60,6 +59,9 @@ class ValidateTest extends \PHPUnit_Framework_TestCase
|
60 | 59 | /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Controller\Result\Json */
|
61 | 60 | protected $resultJson;
|
62 | 61 |
|
| 62 | + /** @var \Magento\Customer\Controller\Adminhtml\Index\Validate */ |
| 63 | + protected $controller; |
| 64 | + |
63 | 65 | public function setUp()
|
64 | 66 | {
|
65 | 67 | $this->customer = $this->getMockForAbstractClass(
|
@@ -130,6 +132,21 @@ public function setUp()
|
130 | 132 | false
|
131 | 133 | );
|
132 | 134 | $this->resultJsonFactory->expects($this->once())->method('create')->willReturn($this->resultJson);
|
| 135 | + |
| 136 | + $objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); |
| 137 | + $this->controller = $objectHelper->getObject( |
| 138 | + 'Magento\Customer\Controller\Adminhtml\Index\Validate', |
| 139 | + [ |
| 140 | + 'request' => $this->request, |
| 141 | + 'response' => $this->response, |
| 142 | + 'customerDataFactory' => $this->customerDataFactory, |
| 143 | + 'formFactory' => $this->formFactory, |
| 144 | + 'extensibleDataObjectConverter' => $this->extensibleDataObjectConverter, |
| 145 | + 'customerAccountManagement' => $this->customerAccountManagement, |
| 146 | + 'resultJsonFactory' => $this->resultJsonFactory, |
| 147 | + 'dataObjectHelper' => $this->dataObjectHelper, |
| 148 | + ] |
| 149 | + ); |
133 | 150 | }
|
134 | 151 |
|
135 | 152 | public function testExecute()
|
@@ -169,7 +186,7 @@ public function testExecute()
|
169 | 186 | ->method('validate')
|
170 | 187 | ->willReturn($validationResult);
|
171 | 188 |
|
172 |
| - $this->getController()->execute(); |
| 189 | + $this->controller->execute(); |
173 | 190 | }
|
174 | 191 |
|
175 | 192 | public function testExecuteWithoutAddresses()
|
@@ -208,7 +225,7 @@ public function testExecuteWithoutAddresses()
|
208 | 225 | ->method('validate')
|
209 | 226 | ->willReturn($validationResult);
|
210 | 227 |
|
211 |
| - $this->getController()->execute(); |
| 228 | + $this->controller->execute(); |
212 | 229 | }
|
213 | 230 |
|
214 | 231 | public function testExecuteWithException()
|
@@ -254,24 +271,6 @@ public function testExecuteWithException()
|
254 | 271 | ->method('validate')
|
255 | 272 | ->willReturn($validationResult);
|
256 | 273 |
|
257 |
| - $this->getController()->execute(); |
258 |
| - } |
259 |
| - |
260 |
| - public function getController() |
261 |
| - { |
262 |
| - $objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); |
263 |
| - return $objectHelper->getObject( |
264 |
| - 'Magento\Customer\Controller\Adminhtml\Index\Validate', |
265 |
| - [ |
266 |
| - 'request' => $this->request, |
267 |
| - 'response' => $this->response, |
268 |
| - 'customerDataFactory' => $this->customerDataFactory, |
269 |
| - 'formFactory' => $this->formFactory, |
270 |
| - 'extensibleDataObjectConverter' => $this->extensibleDataObjectConverter, |
271 |
| - 'customerAccountManagement' => $this->customerAccountManagement, |
272 |
| - 'resultJsonFactory' => $this->resultJsonFactory, |
273 |
| - 'dataObjectHelper' => $this->dataObjectHelper, |
274 |
| - ] |
275 |
| - ); |
| 274 | + $this->controller->execute(); |
276 | 275 | }
|
277 | 276 | }
|
0 commit comments