Skip to content

Commit b235398

Browse files
author
akaash
committed
ACQE-4975 | Static test fix
1 parent 4712830 commit b235398

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserResetPasswordEmailTest.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ public function testLimitNumberOfResetRequestPerHourByEmail(): void
155155
$this->reinitableConfig->reinit();
156156

157157
// Resetting Password
158-
$this->getRequest()->setPostValue('email', $adminEmail);
159-
$this->dispatch('backend/admin/auth/forgotpassword');
158+
$this->resetPassword($adminEmail);
160159

161160
/** @var TransportBuilderMock $transportMock */
162161
$transportMock = Bootstrap::getObjectManager()->get(
@@ -183,19 +182,15 @@ public function testLimitNumberOfResetRequestPerHourByEmail(): void
183182
);
184183
$this->reinitableConfig->reinit();
185184

186-
$this->getRequest()->setPostValue('email', $adminEmail);
187-
$this->dispatch('backend/admin/auth/forgotpassword');
188-
185+
$this->resetPassword($adminEmail);
189186
$this->assertSessionMessages(
190187
$this->equalTo([]),
191188
MessageInterface::TYPE_ERROR
192189
);
193190

194191
// Resetting password multiple times
195192
for ($i = 0; $i < 2; $i++) {
196-
$this->getRequest()->setPostValue('email', $adminEmail);
197-
$this->dispatch('backend/admin/auth/forgotpassword');
198-
193+
$this->resetPassword($adminEmail);
199194
$this->assertSessionMessages(
200195
$this->equalTo(
201196
['We received too many requests for password resets.'
@@ -212,13 +207,21 @@ public function testLimitNumberOfResetRequestPerHourByEmail(): void
212207

213208
$this->assertEquals(0, $connection->fetchOne("SELECT COUNT(*) FROM $tableName"));
214209

215-
$this->getRequest()->setPostValue('email', $adminEmail);
216-
$this->dispatch('backend/admin/auth/forgotpassword');
217-
210+
$this->resetPassword($adminEmail);
218211
$sendMessage = $transportMock->getSentMessage()->getBody()->getParts()[0]->getRawContent();
219212
$this->assertStringContainsString(
220213
'There was recently a request to change the password for your account',
221214
$sendMessage
222215
);
223216
}
217+
218+
/**
219+
* @param $adminEmail
220+
* @return void
221+
*/
222+
private function resetPassword($adminEmail): void
223+
{
224+
$this->getRequest()->setPostValue('email', $adminEmail);
225+
$this->dispatch('backend/admin/auth/forgotpassword');
226+
}
224227
}

0 commit comments

Comments
 (0)