Skip to content
Snippets Groups Projects
Commit 1bb2a3ca authored by Arkadii Chyzhov's avatar Arkadii Chyzhov
Browse files

MAGETWO-6761: Incorrect Url when create admin user with name or email that already exist

- test for the bugfix
parent fc1cb523
No related merge requests found
...@@ -95,6 +95,32 @@ class UserTest extends \Magento\Backend\Utility\Controller ...@@ -95,6 +95,32 @@ class UserTest extends \Magento\Backend\Utility\Controller
$this->assertRedirect($this->stringContains('backend/admin/user/index/')); $this->assertRedirect($this->stringContains('backend/admin/user/index/'));
} }
/**
* @magentoDbIsolation enabled
* @magentoDataFixture Magento/User/_files/user_with_role.php
*/
public function testSaveActionDuplicateUser()
{
$this->getRequest()->setPostValue(
[
'username' => 'adminUser',
'email' => 'adminUser@example.com',
'firstname' => 'John',
'lastname' => 'Doe',
'password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD,
'password_confirmation' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD,
\Magento\User\Block\User\Edit\Tab\Main::CURRENT_USER_PASSWORD_FIELD => Bootstrap::ADMIN_PASSWORD,
]
);
$this->dispatch('backend/admin/user/save/active_tab/main_section');
$this->assertSessionMessages(
$this->equalTo(['A user with the same user name or email already exists.']),
\Magento\Framework\Message\MessageInterface::TYPE_ERROR
);
$this->assertRedirect($this->stringContains('backend/admin/user/edit/'));
$this->assertRedirect($this->matchesRegularExpression('/^((?!active_tab).)*$/'));
}
/** /**
* @magentoDbIsolation enabled * @magentoDbIsolation enabled
* @dataProvider resetPasswordDataProvider * @dataProvider resetPasswordDataProvider
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment