summaryrefslogtreecommitdiffstats
path: root/Core/Tests/Authentication
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2014-04-03 07:23:50 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2014-04-03 07:23:50 +0200
commitf70d3420f4f5bdb9b98ce3c880c7fcd8ccc46918 (patch)
tree45838e66f8c51d95d890b301af28205cfd72f406 /Core/Tests/Authentication
parent75a7667fefc83c8625302983ddf4237a0a966baf (diff)
parent11c6ba069dbe07aa890760544e38585581a2ee6e (diff)
downloadsymfony-security-f70d3420f4f5bdb9b98ce3c880c7fcd8ccc46918.zip
symfony-security-f70d3420f4f5bdb9b98ce3c880c7fcd8ccc46918.tar.gz
symfony-security-f70d3420f4f5bdb9b98ce3c880c7fcd8ccc46918.tar.bz2
Merge branch '2.3' into 2.4v2.5.0-BETA1
* 2.3: Revert PHPUnit version, revert APC configuration removed APC on the CLI for Travis as it does not work well with PHPUnit and Composer anyway [Security] Replace exception mocks with actual exception instances. Remove an unused argument. Use `Filesystem::chmod` instead of `chmod` when dumping file [Form] Added test for disabling buttons [Form] Added check for parent disabled status in Button form elements Fixes URL validator to accept single part urls tweaked Travis configuration to get more tests running fixed float comparison in unit tests for HHVM upgraded PHPUnit to version 4 for better HHVM support [Process] fixed HHVM usage on the CLI Fix class names in ApcUniversalClassLoader tests. fixed the profiler when an uncalled listener throws an exception when instantiated fixed CS Added test case for 4c6a2d15095c13b2a35751b2b2712b183be489c4 Fixed bug in ChoiceType triggering a warning when not using utf-8 fixed CS Avoid levenshtein comparison when using ContainerBuilder. Conflicts: src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
Diffstat (limited to 'Core/Tests/Authentication')
-rw-r--r--Core/Tests/Authentication/AuthenticationProviderManagerTest.php2
-rw-r--r--Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php5
-rw-r--r--Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php3
-rw-r--r--Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php4
-rw-r--r--Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php16
5 files changed, 17 insertions, 13 deletions
diff --git a/Core/Tests/Authentication/AuthenticationProviderManagerTest.php b/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
index b053d73..f63ef79 100644
--- a/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
+++ b/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
@@ -129,7 +129,7 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase
} elseif (null !== $exception) {
$provider->expects($this->once())
->method('authenticate')
- ->will($this->throwException($this->getMock($exception, null, array(), '', false)))
+ ->will($this->throwException($this->getMock($exception, null, array(), '', true)))
;
}
diff --git a/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php b/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
index 3e285d7..ae96f10 100644
--- a/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
+++ b/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
@@ -14,6 +14,7 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider;
+use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
{
@@ -37,7 +38,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
$userProvider->expects($this->once())
->method('loadUserByUsername')
- ->will($this->throwException($this->getMock('Symfony\\Component\\Security\\Core\\Exception\\UsernameNotFoundException', null, array(), '', false)))
+ ->will($this->throwException(new UsernameNotFoundException()))
;
$provider = new DaoAuthenticationProvider($userProvider, $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface'), 'key', $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface'));
@@ -55,7 +56,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
$userProvider->expects($this->once())
->method('loadUserByUsername')
- ->will($this->throwException($this->getMock('RuntimeException', null, array(), '', false)))
+ ->will($this->throwException(new \RuntimeException()))
;
$provider = new DaoAuthenticationProvider($userProvider, $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface'), 'key', $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface'));
diff --git a/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php b/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
index 4a8bf6c..5fd7b05 100644
--- a/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
+++ b/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
+use Symfony\Component\Security\Core\Exception\LockedException;
class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
{
@@ -79,7 +80,7 @@ class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_Test
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
$userChecker->expects($this->once())
->method('checkPostAuth')
- ->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\LockedException', null, array(), '', false)))
+ ->will($this->throwException(new LockedException()))
;
$provider = $this->getProvider($user, $userChecker);
diff --git a/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php b/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
index 43da274..d278ba4 100644
--- a/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
+++ b/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
@@ -12,7 +12,7 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
-use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
+use Symfony\Component\Security\Core\Exception\AccountExpiredException;
use Symfony\Component\Security\Core\Role\Role;
class RememberMeAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
@@ -52,7 +52,7 @@ class RememberMeAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
$userChecker->expects($this->once())
->method('checkPostAuth')
- ->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\AccountExpiredException', null, array(), '', false)))
+ ->will($this->throwException(new AccountExpiredException()))
;
$provider = $this->getProvider($userChecker);
diff --git a/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php b/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
index db47589..0503054 100644
--- a/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
+++ b/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
@@ -11,10 +11,12 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
-use Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider;
+use Symfony\Component\Security\Core\Exception\AccountExpiredException;
+use Symfony\Component\Security\Core\Exception\BadCredentialsException;
+use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
+use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Role\SwitchUserRole;
-use Symfony\Component\Security\Core\Exception\BadCredentialsException;
class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
{
@@ -41,7 +43,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$provider = $this->getProvider(false, false);
$provider->expects($this->once())
->method('retrieveUser')
- ->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\UsernameNotFoundException', null, array(), '', false)))
+ ->will($this->throwException(new UsernameNotFoundException()))
;
$provider->authenticate($this->getSupportedToken());
@@ -55,7 +57,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$provider = $this->getProvider(false, true);
$provider->expects($this->once())
->method('retrieveUser')
- ->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\UsernameNotFoundException', null, array(), '', false)))
+ ->will($this->throwException(new UsernameNotFoundException()))
;
$provider->authenticate($this->getSupportedToken());
@@ -83,7 +85,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
$userChecker->expects($this->once())
->method('checkPreAuth')
- ->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\CredentialsExpiredException', null, array(), '', false)))
+ ->will($this->throwException(new CredentialsExpiredException()))
;
$provider = $this->getProvider($userChecker);
@@ -103,7 +105,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
$userChecker->expects($this->once())
->method('checkPostAuth')
- ->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\AccountExpiredException', null, array(), '', false)))
+ ->will($this->throwException(new AccountExpiredException()))
;
$provider = $this->getProvider($userChecker);
@@ -128,7 +130,7 @@ class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
;
$provider->expects($this->once())
->method('checkAuthentication')
- ->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\BadCredentialsException', null, array(), '', false)))
+ ->will($this->throwException(new BadCredentialsException()))
;
$provider->authenticate($this->getSupportedToken());