|
9 | 9 | namespace Magento\TwoFactorAuth\Test\Integration; |
10 | 10 |
|
11 | 11 | 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; |
13 | 15 | use Magento\TestFramework\Mail\Template\TransportBuilderMock; |
14 | 16 | use Magento\User\Model\User; |
15 | 17 | use Magento\TwoFactorAuth\Api\TfaInterface; |
16 | 18 | use Magento\TwoFactorAuth\Api\UserConfigRequestManagerInterface; |
17 | 19 | use Magento\TwoFactorAuth\Api\UserConfigTokenManagerInterface; |
18 | 20 | use Magento\TwoFactorAuth\Model\Provider\Engine\Google; |
19 | 21 | use PHPUnit\Framework\TestCase; |
| 22 | +use Throwable; |
20 | 23 |
|
21 | 24 | /** |
22 | 25 | * @magentoDbIsolation enabled |
@@ -58,15 +61,15 @@ class UserConfigRequestManagerTest extends TestCase |
58 | 61 | protected function setUp(): void |
59 | 62 | { |
60 | 63 | /** @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); |
63 | 66 | $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); |
68 | 71 |
|
69 | | - $this->manager = Bootstrap::getObjectManager()->get(UserConfigRequestManagerInterface::class); |
| 72 | + $this->manager = BootstrapHelper::getObjectManager()->get(UserConfigRequestManagerInterface::class); |
70 | 73 | } |
71 | 74 |
|
72 | 75 | /** |
@@ -104,25 +107,28 @@ public function testIsRequiredWithConfig(): void |
104 | 107 | } |
105 | 108 |
|
106 | 109 | /** |
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. |
108 | 111 | * |
109 | 112 | * @return void |
110 | | - * @throws \Throwable |
| 113 | + * @throws Throwable |
111 | 114 | * @magentoAppArea adminhtml |
112 | 115 | * @magentoAppIsolation enabled |
113 | 116 | */ |
114 | 117 | public function testFailAppConfigRequest(): void |
115 | 118 | { |
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 | + ); |
118 | 124 | $this->manager->sendConfigRequestTo($this->user); |
119 | 125 | } |
120 | 126 |
|
121 | 127 | /** |
122 | 128 | * Check that app config request E-mail is sent for a user that posseses proper rights. |
123 | 129 | * |
124 | 130 | * @return void |
125 | | - * @throws \Throwable |
| 131 | + * @throws Throwable |
126 | 132 | * @magentoAppArea adminhtml |
127 | 133 | */ |
128 | 134 | public function testSendAppConfigRequest(): void |
@@ -151,7 +157,7 @@ public function testSendAppConfigRequest(): void |
151 | 157 | * Check that personal 2FA config request E-mail is sent for users. |
152 | 158 | * |
153 | 159 | * @return void |
154 | | - * @throws \Throwable |
| 160 | + * @throws Throwable |
155 | 161 | * @magentoAppArea adminhtml |
156 | 162 | * @magentoConfigFixture default/twofactorauth/general/force_providers google |
157 | 163 | */ |
|
0 commit comments