@@ -64,17 +64,6 @@ protected function setUp(): void
64
64
$ this ->randomToken = \bin2hex (\random_bytes (20 ));
65
65
}
66
66
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
-
78
67
/**
79
68
* @covers \SymfonyCasts\Bundle\ResetPassword\ResetPasswordHelper::hasUserHisThrottling
80
69
*/
@@ -304,26 +293,36 @@ public function testValidateTokenThrowsExceptionIfTokenAndVerifierDoNotMatch():
304
293
305
294
public function testGenerateResetTokenCallsGarbageCollector (): void
306
295
{
307
- $ this ->setMockCleanerExpectations ();
296
+ $ this ->mockCleaner
297
+ ->expects ($ this ->once ())
298
+ ->method ('handleGarbageCollection ' )
299
+ ;
308
300
309
301
$ helper = $ this ->getPasswordResetHelper ();
310
302
$ helper ->generateResetToken (new \stdClass ());
311
303
}
312
304
313
305
public function testGarbageCollectorCalledDuringValidation (): void
314
306
{
315
- $ this ->setMockCleanerExpectations ();
307
+ $ this ->mockCleaner
308
+ ->expects ($ this ->once ())
309
+ ->method ('handleGarbageCollection ' )
310
+ ;
311
+
316
312
$ this ->expectException (InvalidResetPasswordTokenException::class);
317
313
318
314
$ helper = $ this ->getPasswordResetHelper ();
319
315
$ helper ->validateTokenAndFetchUser ($ this ->randomToken );
320
316
}
321
317
322
- private function setMockCleanerExpectations (): void
318
+ private function getPasswordResetHelper (): ResetPasswordHelper
323
319
{
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
+ );
328
327
}
329
328
}
0 commit comments