Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a method name in the TwoFactorFrontendListenerTest class #1131

Merged
merged 1 commit into from
Dec 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 15 additions & 15 deletions core-bundle/tests/EventListener/TwoFactorFrontendListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TwoFactorFrontendListenerTest extends ContaoTestCase
{
public function testReturnsIfTheRequestIsNotAFrontendRequest(): void
{
$event = $this->getResponseEvent($this->getRequest());
$event = $this->getRequestEvent($this->getRequest());

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework(),
Expand All @@ -53,7 +53,7 @@ public function testReturnsIfTheRequestIsNotAFrontendRequest(): void

public function testReturnsIfTheTokenIsNotATwoFactorToken(): void
{
$event = $this->getResponseEvent($this->getRequest());
$event = $this->getRequestEvent($this->getRequest());

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework(),
Expand All @@ -70,7 +70,7 @@ public function testReturnsIfTheTokenIsNotATwoFactorToken(): void
public function testReturnsIfTheTokenIsNotSupported(): void
{
$token = $this->createMock(AnonymousToken::class);
$event = $this->getResponseEvent($this->getRequest());
$event = $this->getRequestEvent($this->getRequest());

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework(),
Expand All @@ -87,7 +87,7 @@ public function testReturnsIfTheTokenIsNotSupported(): void
public function testReturnsIfTheRequestHasNoPageModel(): void
{
$token = $this->mockToken(TwoFactorToken::class);
$event = $this->getResponseEvent($this->getRequest());
$event = $this->getRequestEvent($this->getRequest());

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework(),
Expand All @@ -104,7 +104,7 @@ public function testReturnsIfTheRequestHasNoPageModel(): void
public function testReturnsIfTheUserIsNotAFrontendUser(): void
{
$token = $this->mockToken(TwoFactorToken::class);
$event = $this->getResponseEvent($this->getRequest(true));
$event = $this->getRequestEvent($this->getRequest(true));

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework(),
Expand Down Expand Up @@ -137,7 +137,7 @@ public function testThrowsAPageNotFoundExceptionIfThereIsNoTwoFactorPage(): void
;

$token = $this->mockToken(TwoFactorToken::class, true, $user);
$event = $this->getResponseEvent($this->getRequest(true, $pageModel));
$event = $this->getRequestEvent($this->getRequest(true, $pageModel));

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -172,7 +172,7 @@ public function testReturnsIfTwoFactorAuthenticationIsEnforcedAndThePageIsTheTwo
;

$token = $this->mockToken(TwoFactorToken::class, true, $user);
$event = $this->getResponseEvent($this->getRequest(true, $pageModel));
$event = $this->getRequestEvent($this->getRequest(true, $pageModel));

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -217,7 +217,7 @@ public function testRedirectsToTheTwoFactorPageIfTwoFactorAuthenticationIsEnforc

$response = new RedirectResponse('http://localhost/two_factor');
$token = $this->mockToken(TwoFactorToken::class, true, $user);
$event = $this->getResponseEvent($this->getRequest(true, $pageModel), $response);
$event = $this->getRequestEvent($this->getRequest(true, $pageModel), $response);

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -252,7 +252,7 @@ public function testReturnsIfTheUserIsAlreadyAuthenticated(): void

$response = new RedirectResponse('http://localhost/two_factor');
$token = $this->mockToken(UsernamePasswordToken::class, true, $user);
$event = $this->getResponseEvent($this->getRequest(true, $pageModel), $response);
$event = $this->getRequestEvent($this->getRequest(true, $pageModel), $response);

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -302,7 +302,7 @@ public function testRedirectsToTheTargetPathIfThe401PageHasNoRedirect(): void
$request = $this->getRequest(true, $pageModel);
$request->setSession($session);

$event = $this->getResponseEvent($request, $response);
$event = $this->getRequestEvent($request, $response);

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -346,7 +346,7 @@ public function testReturnsIfTheCurrentPageIsThe401AutoforwardTarget(): void

$response = new RedirectResponse('http://localhost/two_factor');
$token = $this->mockToken(TwoFactorToken::class, true, $user);
$event = $this->getResponseEvent($this->getRequest(true, $pageModel), $response);
$event = $this->getRequestEvent($this->getRequest(true, $pageModel), $response);

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -380,7 +380,7 @@ public function testThrowsAnUnauthorizedHttpException(): void

$response = new RedirectResponse('http://localhost/two_factor');
$token = $this->mockToken(TwoFactorToken::class, true, $user);
$event = $this->getResponseEvent($this->getRequest(true, $pageModel), $response);
$event = $this->getRequestEvent($this->getRequest(true, $pageModel), $response);

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -425,7 +425,7 @@ public function testReturnsIfTheCurrentPageIsTheTargetPath(): void
$request = $this->getRequest(true, $pageModel);
$request->setSession($session);

$event = $this->getResponseEvent($request, $response);
$event = $this->getRequestEvent($request, $response);

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -470,7 +470,7 @@ public function testRedirectsToTheTargetPath(): void
$request = $this->getRequest(true, $pageModel);
$request->setSession($session);

$event = $this->getResponseEvent($request, $response);
$event = $this->getRequestEvent($request, $response);

$listener = new TwoFactorFrontendListener(
$this->mockContaoFramework([PageModel::class => $adapter]),
Expand Down Expand Up @@ -566,7 +566,7 @@ private function mockScopeMatcher(bool $hasFrontendUser, RequestEvent $event): S
return $scopeMatcher;
}

private function getResponseEvent(Request $request = null, Response $response = null): RequestEvent
private function getRequestEvent(Request $request = null, Response $response = null): RequestEvent
{
$kernel = $this->createMock(Kernel::class);

Expand Down