Skip to content

Commit 1344db3

Browse files
committed
Merge branch 'AC-2841' of github.com:magento-gl/security-package into AC-2841
2 parents d6abe9c + 5f597e6 commit 1344db3

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

TwoFactorAuth/Test/Integration/UserConfigRequestManagerTest.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
namespace Magento\TwoFactorAuth\Test\Integration;
1010

1111
use Magento\Framework\Acl\Builder;
12-
use Magento\TestFramework\Helper\Bootstrap;
12+
use Magento\Framework\Exception\AuthorizationException;
13+
use Magento\TestFramework\Bootstrap;
14+
use Magento\TestFramework\Helper\Bootstrap as BootstrapHelper;
1315
use Magento\TestFramework\Mail\Template\TransportBuilderMock;
1416
use Magento\User\Model\User;
1517
use Magento\TwoFactorAuth\Api\TfaInterface;
1618
use Magento\TwoFactorAuth\Api\UserConfigRequestManagerInterface;
1719
use Magento\TwoFactorAuth\Api\UserConfigTokenManagerInterface;
1820
use Magento\TwoFactorAuth\Model\Provider\Engine\Google;
1921
use PHPUnit\Framework\TestCase;
22+
use Throwable;
2023

2124
/**
2225
* @magentoDbIsolation enabled
@@ -58,15 +61,15 @@ class UserConfigRequestManagerTest extends TestCase
5861
protected function setUp(): void
5962
{
6063
/** @var User $user */
61-
$user = Bootstrap::getObjectManager()->create(User::class);
62-
$user->loadByUsername(\Magento\TestFramework\Bootstrap::ADMIN_NAME);
64+
$user = BootstrapHelper::getObjectManager()->create(User::class);
65+
$user->loadByUsername(Bootstrap::ADMIN_NAME);
6366
$this->user = $user;
64-
$this->tfa = Bootstrap::getObjectManager()->get(TfaInterface::class);
65-
$this->transportBuilderMock = Bootstrap::getObjectManager()->get(TransportBuilderMock::class);
66-
$this->tokenManager = Bootstrap::getObjectManager()->get(UserConfigTokenManagerInterface::class);
67-
$this->aclBuilder = Bootstrap::getObjectManager()->get(Builder::class);
67+
$this->tfa = BootstrapHelper::getObjectManager()->get(TfaInterface::class);
68+
$this->transportBuilderMock = BootstrapHelper::getObjectManager()->get(TransportBuilderMock::class);
69+
$this->tokenManager = BootstrapHelper::getObjectManager()->get(UserConfigTokenManagerInterface::class);
70+
$this->aclBuilder = BootstrapHelper::getObjectManager()->get(Builder::class);
6871

69-
$this->manager = Bootstrap::getObjectManager()->get(UserConfigRequestManagerInterface::class);
72+
$this->manager = BootstrapHelper::getObjectManager()->get(UserConfigRequestManagerInterface::class);
7073
}
7174

7275
/**
@@ -104,25 +107,28 @@ public function testIsRequiredWithConfig(): void
104107
}
105108

106109
/**
107-
* Check that app config request E-mail is NOT sent for a user that does not posses proper rights.
110+
* Check that app config request E-mail is NOT sent for a user that does not possess proper rights.
108111
*
109112
* @return void
110-
* @throws \Throwable
113+
* @throws Throwable
111114
* @magentoAppArea adminhtml
112115
* @magentoAppIsolation enabled
113116
*/
114117
public function testFailAppConfigRequest(): void
115118
{
116-
$this->expectException(\Magento\Framework\Exception\AuthorizationException::class);
117-
$this->aclBuilder->getAcl()->deny(null, 'Magento_TwoFactorAuth::config');
119+
$this->expectException(AuthorizationException::class);
120+
$this->aclBuilder->getAcl()->deny(
121+
Bootstrap::ADMIN_ROLE_ID,
122+
'Magento_TwoFactorAuth::config'
123+
);
118124
$this->manager->sendConfigRequestTo($this->user);
119125
}
120126

121127
/**
122128
* Check that app config request E-mail is sent for a user that posseses proper rights.
123129
*
124130
* @return void
125-
* @throws \Throwable
131+
* @throws Throwable
126132
* @magentoAppArea adminhtml
127133
*/
128134
public function testSendAppConfigRequest(): void
@@ -151,7 +157,7 @@ public function testSendAppConfigRequest(): void
151157
* Check that personal 2FA config request E-mail is sent for users.
152158
*
153159
* @return void
154-
* @throws \Throwable
160+
* @throws Throwable
155161
* @magentoAppArea adminhtml
156162
* @magentoConfigFixture default/twofactorauth/general/force_providers google
157163
*/

0 commit comments

Comments
 (0)