Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MassUnlockTest.php
Go to the documentation of this file.
1 <?php
7 
9 {
16  public function testMassUnlockAction()
17  {
18  $userIds = [];
21  $model = $objectManager->create(\Magento\User\Model\User::class);
22  $userIds[] = $model->loadByUsername('adminUser1')->getId();
23  $userIds[] = $model->loadByUsername('adminUser2')->getId();
24 
25  $request = $this->getRequest();
26  $request->setPostValue(
27  'unlock',
28  $userIds
29  );
30  $this->dispatch('backend/admin/locks/massunlock');
31 
32  $this->assertSessionMessages(
33  $this->contains((string)__('Unlocked %1 user(s).', count($userIds))),
34  \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
35  );
36  $this->assertRedirect();
37  }
38 }
assertRedirect(\PHPUnit\Framework\Constraint\Constraint $urlConstraint=null)
$objectManager
Definition: bootstrap.php:17
__()
Definition: __.php:13
$userIds
dispatch(\Magento\Framework\App\RequestInterface $request)
assertSessionMessages(\PHPUnit\Framework\Constraint\Constraint $constraint, $messageType=null, $messageManagerClass=\Magento\Framework\Message\Manager::class)