Skip to content

Commit

Permalink
Mock SwitchUserToken properly
Browse files Browse the repository at this point in the history
  • Loading branch information
bytehead committed Nov 12, 2021
1 parent 0e200d0 commit c792349
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,14 @@ public function testAddsTheLogoutButton(TokenInterface $token, string $label, st

public function getLogoutData(): \Generator
{
$switchUserToken = $this->createMock(SwitchUserToken::class);
$switchUserToken
->method('getOriginalToken')
->willReturn($this->createMock(UsernamePasswordToken::class))
;

yield [$this->createMock(UsernamePasswordToken::class), 'MSC.logoutBT', '/contao/logout'];
yield [$this->createMock(SwitchUserToken::class), 'MSC.switchBT', '/contao?do=user&_switch_user=_exit'];
yield [$switchUserToken, 'MSC.switchBT', '/contao?do=user&_switch_user=_exit'];
}

public function testDoesNotAddTheLogoutButtonIfTheUserRoleIsNotGranted(): void
Expand Down

0 comments on commit c792349

Please sign in to comment.