diff options
author | Ryan Weaver <ryan@thatsquality.com> | 2016-03-12 12:14:01 -0500 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2016-03-31 07:33:59 +0200 |
commit | 2a3ff4c385a48668a2595bddb5ecbc45830c03cd (patch) | |
tree | 7dc3a78ebca99626e164ba6357ca28d7be19212b /Guard/Tests | |
parent | eb2d9075275e762a5086786449a820b07176f0d0 (diff) | |
download | symfony-security-2a3ff4c385a48668a2595bddb5ecbc45830c03cd.zip symfony-security-2a3ff4c385a48668a2595bddb5ecbc45830c03cd.tar.gz symfony-security-2a3ff4c385a48668a2595bddb5ecbc45830c03cd.tar.bz2 |
[Security] Deprecate onAuthenticationSuccess()
Diffstat (limited to 'Guard/Tests')
-rw-r--r-- | Guard/Tests/Authenticator/AbstractFormLoginAuthenticatorTest.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Guard/Tests/Authenticator/AbstractFormLoginAuthenticatorTest.php b/Guard/Tests/Authenticator/AbstractFormLoginAuthenticatorTest.php new file mode 100644 index 0000000..e86b5ad --- /dev/null +++ b/Guard/Tests/Authenticator/AbstractFormLoginAuthenticatorTest.php @@ -0,0 +1,64 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Tests\Authenticator; + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator; + +class AbstractFormLoginAuthenticatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @group legacy + */ + public function testLegacyWithLoginUrl() + { + $request = new Request(); + $request->setSession($this->getMock('Symfony\Component\HttpFoundation\Session\Session')); + + $authenticator = new LegacyFormLoginAuthenticator(); + /** @var RedirectResponse $actualResponse */ + $actualResponse = $authenticator->onAuthenticationSuccess( + $request, + $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'), + 'provider_key' + ); + + $this->assertEquals('/default_url', $actualResponse->getTargetUrl()); + } +} + +class LegacyFormLoginAuthenticator extends AbstractFormLoginAuthenticator +{ + protected function getDefaultSuccessRedirectUrl() + { + return '/default_url'; + } + + protected function getLoginUrl() + { + } + + public function getCredentials(Request $request) + { + } + + public function getUser($credentials, UserProviderInterface $userProvider) + { + } + + public function checkCredentials($credentials, UserInterface $user) + { + } +} |