Skip to content

Commit 90e0bd1

Browse files
committed
MAGETWO-55849: Customer can be deleted without Merchant permissions verification
1 parent 63f6f48 commit 90e0bd1

File tree

1 file changed

+7
-17
lines changed
  • app/code/Magento/User/Test/Unit/Controller/Adminhtml/User

1 file changed

+7
-17
lines changed

app/code/Magento/User/Test/Unit/Controller/Adminhtml/User/DeleteTest.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@
66

77
namespace Magento\User\Test\Unit\Controller\Adminhtml\User;
88

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;
1210
use Magento\Framework\Exception\AuthenticationException;
1311

1412
/**
1513
* Test class for \Magento\User\Controller\Adminhtml\User\Delete testing
16-
*
17-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1814
*/
1915
class DeleteTest extends \PHPUnit_Framework_TestCase
2016
{
@@ -97,21 +93,15 @@ protected function setUp()
9793
->disableOriginalConstructor()
9894
->getMock();
9995

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,
103100
[
104101
'request' => $this->requestMock,
105102
'response' => $this->responseMock,
106103
'objectManager' => $this->objectManagerMock,
107104
'messageManager' => $this->messageManagerMock,
108-
]
109-
);
110-
111-
$this->controller = $objectManager->getObject(
112-
\Magento\User\Controller\Adminhtml\User\Delete::class,
113-
[
114-
'context' => $context,
115105
'userFactory' => $this->userFactoryMock,
116106
]
117107
);
@@ -146,7 +136,7 @@ public function testExecute($currentUserPassword, $userId, $currentUserId, $resu
146136
->method('getPost')
147137
->willReturnMap([
148138
['user_id', $userId],
149-
[UserEdit::CURRENT_USER_PASSWORD_FIELD, $currentUserPassword],
139+
[\Magento\User\Block\User\Edit\Tab\Main::CURRENT_USER_PASSWORD_FIELD, $currentUserPassword],
150140
]);
151141

152142
$userMock = clone $currentUserMock;
@@ -185,7 +175,7 @@ public function testEmptyPasswordThrowsException()
185175
->method('getPost')
186176
->willReturnMap([
187177
['user_id', $userId],
188-
[UserEdit::CURRENT_USER_PASSWORD_FIELD, ''],
178+
[\Magento\User\Block\User\Edit\Tab\Main::CURRENT_USER_PASSWORD_FIELD, ''],
189179
]);
190180

191181
$this->controller->execute();

0 commit comments

Comments
 (0)