|
6 | 6 |
|
7 | 7 | namespace Magento\User\Test\Unit\Controller\Adminhtml\User;
|
8 | 8 |
|
9 |
| -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; |
10 |
| -use Magento\User\Block\User\Edit\Tab\Main as UserEdit; |
11 |
| -use Magento\Backend\Model\Auth\Session as Session; |
| 9 | +use Magento\Backend\Model\Auth\Session; |
12 | 10 | use Magento\Framework\Exception\AuthenticationException;
|
13 | 11 |
|
14 | 12 | /**
|
15 | 13 | * Test class for \Magento\User\Controller\Adminhtml\User\Delete testing
|
16 |
| - * |
17 |
| - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
18 | 14 | */
|
19 | 15 | class DeleteTest extends \PHPUnit_Framework_TestCase
|
20 | 16 | {
|
@@ -97,21 +93,15 @@ protected function setUp()
|
97 | 93 | ->disableOriginalConstructor()
|
98 | 94 | ->getMock();
|
99 | 95 |
|
100 |
| - $objectManager = new ObjectManagerHelper($this); |
101 |
| - $context = $objectManager->getObject( |
102 |
| - \Magento\Backend\App\Action\Context::class, |
| 96 | + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); |
| 97 | + |
| 98 | + $this->controller = $objectManager->getObject( |
| 99 | + \Magento\User\Controller\Adminhtml\User\Delete::class, |
103 | 100 | [
|
104 | 101 | 'request' => $this->requestMock,
|
105 | 102 | 'response' => $this->responseMock,
|
106 | 103 | 'objectManager' => $this->objectManagerMock,
|
107 | 104 | 'messageManager' => $this->messageManagerMock,
|
108 |
| - ] |
109 |
| - ); |
110 |
| - |
111 |
| - $this->controller = $objectManager->getObject( |
112 |
| - \Magento\User\Controller\Adminhtml\User\Delete::class, |
113 |
| - [ |
114 |
| - 'context' => $context, |
115 | 105 | 'userFactory' => $this->userFactoryMock,
|
116 | 106 | ]
|
117 | 107 | );
|
@@ -146,7 +136,7 @@ public function testExecute($currentUserPassword, $userId, $currentUserId, $resu
|
146 | 136 | ->method('getPost')
|
147 | 137 | ->willReturnMap([
|
148 | 138 | ['user_id', $userId],
|
149 |
| - [UserEdit::CURRENT_USER_PASSWORD_FIELD, $currentUserPassword], |
| 139 | + [\Magento\User\Block\User\Edit\Tab\Main::CURRENT_USER_PASSWORD_FIELD, $currentUserPassword], |
150 | 140 | ]);
|
151 | 141 |
|
152 | 142 | $userMock = clone $currentUserMock;
|
@@ -185,7 +175,7 @@ public function testEmptyPasswordThrowsException()
|
185 | 175 | ->method('getPost')
|
186 | 176 | ->willReturnMap([
|
187 | 177 | ['user_id', $userId],
|
188 |
| - [UserEdit::CURRENT_USER_PASSWORD_FIELD, ''], |
| 178 | + [\Magento\User\Block\User\Edit\Tab\Main::CURRENT_USER_PASSWORD_FIELD, ''], |
189 | 179 | ]);
|
190 | 180 |
|
191 | 181 | $this->controller->execute();
|
|
0 commit comments