summaryrefslogtreecommitdiffstats
path: root/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php
diff options
context:
space:
mode:
authorJakub Zalas <jakub@zalas.pl>2014-04-01 15:48:06 +0100
committerJakub Zalas <jakub@zalas.pl>2014-04-01 15:48:06 +0100
commit11c6ba069dbe07aa890760544e38585581a2ee6e (patch)
tree19631b9fcf8a7d0f708d9a3185c56a1d5e147492 /Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php
parentefead6dbd9f02b485753a33c7559797e8a39dc79 (diff)
downloadsymfony-security-11c6ba069dbe07aa890760544e38585581a2ee6e.zip
symfony-security-11c6ba069dbe07aa890760544e38585581a2ee6e.tar.gz
symfony-security-11c6ba069dbe07aa890760544e38585581a2ee6e.tar.bz2
[Security] Replace exception mocks with actual exception instances.v2.3.12
It is done for two reasons: * consistency - we use real exception objects in most of the code * latest phpunit does not like the way we were creating mocks for exceptions (it could be also fixed by letting phpunit to call the original constructor)
Diffstat (limited to 'Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php')
-rw-r--r--Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php b/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php
index d5d6067..35b14e8 100644
--- a/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php
+++ b/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php
@@ -14,6 +14,7 @@ namespace Symfony\Component\Security\Tests\Core\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'));