Skip to content

Commit 1bb2a3c

Browse files
committed
MAGETWO-6761: Incorrect Url when create admin user with name or email that already exist
- test for the bugfix
1 parent fc1cb52 commit 1bb2a3c

File tree

1 file changed

+26
-0
lines changed
  • dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml

1 file changed

+26
-0
lines changed

dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,32 @@ public function testSaveAction()
9595
$this->assertRedirect($this->stringContains('backend/admin/user/index/'));
9696
}
9797

98+
/**
99+
* @magentoDbIsolation enabled
100+
* @magentoDataFixture Magento/User/_files/user_with_role.php
101+
*/
102+
public function testSaveActionDuplicateUser()
103+
{
104+
$this->getRequest()->setPostValue(
105+
[
106+
'username' => 'adminUser',
107+
'email' => 'adminUser@example.com',
108+
'firstname' => 'John',
109+
'lastname' => 'Doe',
110+
'password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD,
111+
'password_confirmation' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD,
112+
\Magento\User\Block\User\Edit\Tab\Main::CURRENT_USER_PASSWORD_FIELD => Bootstrap::ADMIN_PASSWORD,
113+
]
114+
);
115+
$this->dispatch('backend/admin/user/save/active_tab/main_section');
116+
$this->assertSessionMessages(
117+
$this->equalTo(['A user with the same user name or email already exists.']),
118+
\Magento\Framework\Message\MessageInterface::TYPE_ERROR
119+
);
120+
$this->assertRedirect($this->stringContains('backend/admin/user/edit/'));
121+
$this->assertRedirect($this->matchesRegularExpression('/^((?!active_tab).)*$/'));
122+
}
123+
98124
/**
99125
* @magentoDbIsolation enabled
100126
* @dataProvider resetPasswordDataProvider

0 commit comments

Comments
 (0)