Skip to content

Commit ea07f3c

Browse files
author
Cari Spruiell
committed
Merge branches 'MAGETWO-6761-Incorrect-Url-When-Duplicate-3' and 'develop' of github.scm.corp.ebay.com:magento-api/magento2ce into develop
2 parents 96bb665 + 1bb2a3c commit ea07f3c

File tree

2 files changed

+27
-1
lines changed
  • app/code/Magento/User/Controller/Adminhtml/User
  • dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml

2 files changed

+27
-1
lines changed

app/code/Magento/User/Controller/Adminhtml/User/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function redirectToEdit(\Magento\User\Model\User $model, array $data)
8383
{
8484
$this->_getSession()->setUserData($data);
8585
$arguments = $model->getId() ? ['user_id' => $model->getId()] : [];
86-
$arguments = array_merge($arguments, ['_current' => true]);
86+
$arguments = array_merge($arguments, ['_current' => true, 'active_tab' => '']);
8787
$this->_redirect('adminhtml/*/edit', $arguments);
8888
}
8989
}

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)