Skip to content

Commit

Permalink
Add compatibility with symfony 5.3
Browse files Browse the repository at this point in the history
Implementing getUserIdentifier and using HttpKernelInterface::MAIN_REQUEST
  • Loading branch information
franmomu committed Jun 6, 2021
1 parent 80d804e commit 7f4b8e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/EventSubscriber/LocaleSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,18 @@ public function testLocaleSubscriberDefault(): void
$this->assertSame('fr', $request->getLocale());
}

/**
* @psalm-suppress DeprecatedConstant
*/
private function getEvent(Request $request): RequestEvent
{
return new RequestEvent(
$this->createMock(HttpKernelInterface::class),
$request,
HttpKernelInterface::MASTER_REQUEST
// @TODO: Use "HttpKernelInterface::MAIN_REQUEST" when support of Symfony <5.2 is dropped
\defined(HttpKernelInterface::class.'::MAIN_REQUEST')
? HttpKernelInterface::MAIN_REQUEST
: HttpKernelInterface::MASTER_REQUEST
);
}
}
5 changes: 5 additions & 0 deletions tests/EventSubscriber/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public function getUsername(): string
return 'username';
}

public function getUserIdentifier(): string
{
return 'username';
}

public function eraseCredentials(): void
{
}
Expand Down

0 comments on commit 7f4b8e5

Please sign in to comment.