Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LockAdminUserWhenEditingUserTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\User\Test\Page\Adminhtml\UserEdit;
10 use Magento\User\Test\Page\Adminhtml\UserIndex;
13 use Magento\Mtf\TestCase\Injectable;
14 
31 class LockAdminUserWhenEditingUserTest extends Injectable
32 {
33  /* tags */
34  const MVP = 'yes';
35  const SEVERITY = 'S2';
36  /* end tags */
37 
43  protected $userIndexPage;
44 
50  protected $userEditPage;
51 
55  protected $configData;
56 
60  protected $adminAuthLogin;
61 
68  public function __inject(
69  UserIndex $userIndex,
70  UserEdit $userEdit,
72  ) {
73  $this->userIndexPage = $userIndex;
74  $this->userEditPage = $userEdit;
75  $this->adminAuthLogin = $adminAuthLogin;
76  }
77 
87  public function test(
88  $attempts,
89  User $customAdmin,
90  User $user,
92  ) {
93  $this->configData = $configData;
94 
95  // Preconditions
96  $this->objectManager->create(
97  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
98  ['configData' => $this->configData]
99  )->run();
100  $customAdmin->persist();
101 
102  // Steps login to backend with new user
103  $this->adminAuthLogin->open();
104  $this->adminAuthLogin->getLoginBlock()->fill($customAdmin);
105  $this->adminAuthLogin->getLoginBlock()->submit();
106  // Select user to edit.
107  $filter = ['username' => $customAdmin->getUsername()];
108  $this->userIndexPage->open();
109  $this->userIndexPage->getUserGrid()->searchAndOpen($filter);
110  // Edit user with wrong password
111  for ($i = 0; $i < $attempts; $i++) {
112  $this->userEditPage->getUserForm()->fill($user);
113  $this->userEditPage->getPageActions()->save();
114  }
115  // Reload
116  $this->adminAuthLogin->open();
117  $this->adminAuthLogin->getLoginBlock()->fill($customAdmin);
118  $this->adminAuthLogin->getLoginBlock()->submit();
119  }
120 
126  public function tearDown()
127  {
128  $this->objectManager->create(
129  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
130  ['configData' => $this->configData, 'rollback' => true]
131  )->run();
132  }
133 }
test( $attempts, User $customAdmin, User $user, $configData)
$user
Definition: dummy_user.php:13
__inject(UserIndex $userIndex, UserEdit $userEdit, AdminAuthLogin $adminAuthLogin)
$i
Definition: gallery.phtml:31