Skip to content

Commit 8088d1a

Browse files
authored
feature #302 [trait] remove deprecated methods in ResetPasswordControllerTrait
1 parent 18d7045 commit 8088d1a

File tree

4 files changed

+9
-77
lines changed

4 files changed

+9
-77
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ find a change that break's semver, please create an issue.*
99

1010
### Feature
1111

12+
- [#302](https://github.com/symfonycasts/reset-password-bundle/pull/302) - [trait] remove deprecated methods in `ReserPasswordControllerTrait` - *@jrushlow*
1213
- [#300](https://github.com/symfonycasts/reset-password-bundle/pull/300) - [interface] change `generateResetToken()` signature - *@jrushlow*
1314
- [#298](https://github.com/symfonycasts/reset-password-bundle/pull/298) - replace final annotation with final class keyword - *@jrushlow*
1415
- [#295](https://github.com/symfonycasts/reset-password-bundle/pull/295) - [command] use `AsCommand` attribute - *@jrushlow*

UPGRADING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ replaced with the `final` class keyword. Extending this class is not allowed.
2323
replaced with the `final` class keyword. Extending this class is not allowed.
2424

2525
- Command is now registered using the Symfony `#[AsCommand]` attribute
26+
27+
## ResetPasswordControllerTrait
28+
29+
- Removed deprecated `setCanCheckEmailInSession()` method from trait.
30+
31+
- Removed deprecated `canCheckEmail()` method from trait.

src/Controller/ResetPasswordControllerTrait.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,6 @@
2424
*/
2525
trait ResetPasswordControllerTrait
2626
{
27-
/**
28-
* @deprecated since 1.3.0, use ResetPasswordControllerTrait::setTokenObjectInSession() instead.
29-
*/
30-
private function setCanCheckEmailInSession(): void
31-
{
32-
trigger_deprecation(
33-
'symfonycasts/reset-password-bundle',
34-
'1.3.0',
35-
'Storing the ResetPasswordToken object in the session is more desirable, use ResetPasswordControllerTrait::setTokenObjectInSession() instead.'
36-
);
37-
38-
$this->getSessionService()->set('ResetPasswordCheckEmail', true);
39-
}
40-
41-
/**
42-
* @deprecated since 1.3.0, use ResetPasswordControllerTrait::getTokenObjectFromSession() instead.
43-
*/
44-
private function canCheckEmail(): bool
45-
{
46-
trigger_deprecation(
47-
'symfonycasts/reset-password-bundle',
48-
'1.3.0',
49-
'Storing the ResetPasswordToken object in the session is more desirable, use ResetPasswordControllerTrait::getTokenObjectFromSession() instead.'
50-
);
51-
52-
return $this->getSessionService()->has('ResetPasswordCheckEmail');
53-
}
54-
5527
private function storeTokenInSession(string $token): void
5628
{
5729
$this->getSessionService()->set('ResetPasswordPublicToken', $token);

tests/Unit/Controller/ResetPasswordControllerTraitTest.php

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ class ResetPasswordControllerTraitTest extends TestCase
2828
private const TOKEN_KEY = 'ResetPasswordPublicToken';
2929
private const TOKEN_OBJECT_KEY = 'ResetPasswordToken';
3030

31-
/**
32-
* @var MockObject|SessionInterface
33-
*/
34-
private $mockSession;
31+
private MockObject&SessionInterface $mockSession;
3532

3633
protected function setUp(): void
3734
{
@@ -63,37 +60,6 @@ public function testGetsTokenFromSession(): void
6360
$fixture->getToken();
6461
}
6562

66-
/**
67-
* @group legacy
68-
*/
69-
public function testSetsEmailFlagInSession(): void
70-
{
71-
$this->mockSession
72-
->expects($this->once())
73-
->method('set')
74-
->with(self::EMAIL_KEY)
75-
;
76-
77-
$fixture = $this->getFixture();
78-
$fixture->setEmail();
79-
}
80-
81-
/**
82-
* @group legacy
83-
*/
84-
public function testCanCheckEmailUsesCorrectKey(): void
85-
{
86-
$this->mockSession
87-
->expects($this->once())
88-
->method('has')
89-
->with(self::EMAIL_KEY)
90-
->willReturn(true)
91-
;
92-
93-
$fixture = $this->getFixture();
94-
$fixture->getEmail();
95-
}
96-
9763
public function testSetsResetTokenInSession(): void
9864
{
9965
$token = new ResetPasswordToken('1234', new \DateTimeImmutable(), 1234);
@@ -137,10 +103,7 @@ public function testCleanSessionAfterServiceRemovesByTokenAndEmailKeys(): void
137103
$fixture->clearSession();
138104
}
139105

140-
/**
141-
* @return MockObject|ContainerInterface
142-
*/
143-
private function getConfiguredMockContainer()
106+
private function getConfiguredMockContainer(): MockObject&ContainerInterface
144107
{
145108
$mockRequest = $this->createMock(Request::class);
146109
$mockRequest
@@ -181,16 +144,6 @@ public function __construct(ContainerInterface $container)
181144
$this->container = $container;
182145
}
183146

184-
public function setEmail(): void
185-
{
186-
$this->setCanCheckEmailInSession();
187-
}
188-
189-
public function getEmail(): bool
190-
{
191-
return $this->canCheckEmail();
192-
}
193-
194147
public function storeToken(string $token): void
195148
{
196149
$this->storeTokenInSession($token);

0 commit comments

Comments
 (0)