Skip to content

Commit 7b64959

Browse files
committed
moved/removed private methods as needed
1 parent 6fb9424 commit 7b64959

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

tests/UnitTests/ResetPasswordHelperTest.php

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ protected function setUp(): void
6464
$this->randomToken = \bin2hex(\random_bytes(20));
6565
}
6666

67-
private function getPasswordResetHelper(): ResetPasswordHelper
68-
{
69-
return new ResetPasswordHelper(
70-
$this->mockTokenGenerator,
71-
$this->mockCleaner,
72-
$this->mockRepo,
73-
99999999,
74-
99999999
75-
);
76-
}
77-
7867
/**
7968
* @covers \SymfonyCasts\Bundle\ResetPassword\ResetPasswordHelper::hasUserHisThrottling
8069
*/
@@ -304,26 +293,36 @@ public function testValidateTokenThrowsExceptionIfTokenAndVerifierDoNotMatch():
304293

305294
public function testGenerateResetTokenCallsGarbageCollector(): void
306295
{
307-
$this->setMockCleanerExpectations();
296+
$this->mockCleaner
297+
->expects($this->once())
298+
->method('handleGarbageCollection')
299+
;
308300

309301
$helper = $this->getPasswordResetHelper();
310302
$helper->generateResetToken(new \stdClass());
311303
}
312304

313305
public function testGarbageCollectorCalledDuringValidation(): void
314306
{
315-
$this->setMockCleanerExpectations();
307+
$this->mockCleaner
308+
->expects($this->once())
309+
->method('handleGarbageCollection')
310+
;
311+
316312
$this->expectException(InvalidResetPasswordTokenException::class);
317313

318314
$helper = $this->getPasswordResetHelper();
319315
$helper->validateTokenAndFetchUser($this->randomToken);
320316
}
321317

322-
private function setMockCleanerExpectations(): void
318+
private function getPasswordResetHelper(): ResetPasswordHelper
323319
{
324-
$this->mockCleaner
325-
->expects($this->once())
326-
->method('handleGarbageCollection')
327-
;
320+
return new ResetPasswordHelper(
321+
$this->mockTokenGenerator,
322+
$this->mockCleaner,
323+
$this->mockRepo,
324+
99999999,
325+
99999999
326+
);
328327
}
329328
}

0 commit comments

Comments
 (0)