MassUnlockTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\User\Controller\Adminhtml\Locks;
  7. class MassUnlockTest extends \Magento\TestFramework\TestCase\AbstractBackendController
  8. {
  9. /**
  10. * Test index action
  11. *
  12. * @magentoDbIsolation enabled
  13. * @magentoDataFixture Magento/User/_files/locked_users.php
  14. */
  15. public function testMassUnlockAction()
  16. {
  17. $userIds = [];
  18. $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
  19. /** @var $model \Magento\User\Model\User */
  20. $model = $objectManager->create(\Magento\User\Model\User::class);
  21. $userIds[] = $model->loadByUsername('adminUser1')->getId();
  22. $userIds[] = $model->loadByUsername('adminUser2')->getId();
  23. $request = $this->getRequest();
  24. $request->setPostValue(
  25. 'unlock',
  26. $userIds
  27. );
  28. $this->dispatch('backend/admin/locks/massunlock');
  29. $this->assertSessionMessages(
  30. $this->contains((string)__('Unlocked %1 user(s).', count($userIds))),
  31. \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
  32. );
  33. $this->assertRedirect();
  34. }
  35. }