Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit f70d342

Browse files
committed
Merge branch '2.3' into 2.4
* 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
2 parents 75a7667 + 11c6ba0 commit f70d342

5 files changed

+17
-13
lines changed

Core/Tests/Authentication/AuthenticationProviderManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected function getAuthenticationProvider($supports, $token = null, $exceptio
129129
} elseif (null !== $exception) {
130130
$provider->expects($this->once())
131131
->method('authenticate')
132-
->will($this->throwException($this->getMock($exception, null, array(), '', false)))
132+
->will($this->throwException($this->getMock($exception, null, array(), '', true)))
133133
;
134134
}
135135

Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
1515

1616
use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider;
17+
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
1718

1819
class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
1920
{
@@ -37,7 +38,7 @@ public function testRetrieveUserWhenUsernameIsNotFound()
3738
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
3839
$userProvider->expects($this->once())
3940
->method('loadUserByUsername')
40-
->will($this->throwException($this->getMock('Symfony\\Component\\Security\\Core\\Exception\\UsernameNotFoundException', null, array(), '', false)))
41+
->will($this->throwException(new UsernameNotFoundException()))
4142
;
4243

4344
$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 @@ public function testRetrieveUserWhenAnExceptionOccurs()
5556
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
5657
$userProvider->expects($this->once())
5758
->method('loadUserByUsername')
58-
->will($this->throwException($this->getMock('RuntimeException', null, array(), '', false)))
59+
->will($this->throwException(new \RuntimeException()))
5960
;
6061

6162
$provider = new DaoAuthenticationProvider($userProvider, $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface'), 'key', $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface'));

Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
1313

1414
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
15+
use Symfony\Component\Security\Core\Exception\LockedException;
1516

1617
class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
1718
{
@@ -79,7 +80,7 @@ public function testAuthenticateWhenUserCheckerThrowsException()
7980
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
8081
$userChecker->expects($this->once())
8182
->method('checkPostAuth')
82-
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\LockedException', null, array(), '', false)))
83+
->will($this->throwException(new LockedException()))
8384
;
8485

8586
$provider = $this->getProvider($user, $userChecker);

Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
1313

1414
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
15-
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
15+
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
1616
use Symfony\Component\Security\Core\Role\Role;
1717

1818
class RememberMeAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
@@ -52,7 +52,7 @@ public function testAuthenticateWhenPostChecksFails()
5252
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
5353
$userChecker->expects($this->once())
5454
->method('checkPostAuth')
55-
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\AccountExpiredException', null, array(), '', false)))
55+
->will($this->throwException(new AccountExpiredException()))
5656
;
5757

5858
$provider = $this->getProvider($userChecker);

Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
1313

14-
use Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider;
14+
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
15+
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
16+
use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
17+
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
1518
use Symfony\Component\Security\Core\Role\Role;
1619
use Symfony\Component\Security\Core\Role\SwitchUserRole;
17-
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
1820

1921
class UserAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
2022
{
@@ -41,7 +43,7 @@ public function testAuthenticateWhenUsernameIsNotFound()
4143
$provider = $this->getProvider(false, false);
4244
$provider->expects($this->once())
4345
->method('retrieveUser')
44-
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\UsernameNotFoundException', null, array(), '', false)))
46+
->will($this->throwException(new UsernameNotFoundException()))
4547
;
4648

4749
$provider->authenticate($this->getSupportedToken());
@@ -55,7 +57,7 @@ public function testAuthenticateWhenUsernameIsNotFoundAndHideIsTrue()
5557
$provider = $this->getProvider(false, true);
5658
$provider->expects($this->once())
5759
->method('retrieveUser')
58-
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\UsernameNotFoundException', null, array(), '', false)))
60+
->will($this->throwException(new UsernameNotFoundException()))
5961
;
6062

6163
$provider->authenticate($this->getSupportedToken());
@@ -83,7 +85,7 @@ public function testAuthenticateWhenPreChecksFails()
8385
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
8486
$userChecker->expects($this->once())
8587
->method('checkPreAuth')
86-
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\CredentialsExpiredException', null, array(), '', false)))
88+
->will($this->throwException(new CredentialsExpiredException()))
8789
;
8890

8991
$provider = $this->getProvider($userChecker);
@@ -103,7 +105,7 @@ public function testAuthenticateWhenPostChecksFails()
103105
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
104106
$userChecker->expects($this->once())
105107
->method('checkPostAuth')
106-
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\AccountExpiredException', null, array(), '', false)))
108+
->will($this->throwException(new AccountExpiredException()))
107109
;
108110

109111
$provider = $this->getProvider($userChecker);
@@ -128,7 +130,7 @@ public function testAuthenticateWhenPostCheckAuthenticationFails()
128130
;
129131
$provider->expects($this->once())
130132
->method('checkAuthentication')
131-
->will($this->throwException($this->getMock('Symfony\Component\Security\Core\Exception\BadCredentialsException', null, array(), '', false)))
133+
->will($this->throwException(new BadCredentialsException()))
132134
;
133135

134136
$provider->authenticate($this->getSupportedToken());

0 commit comments

Comments
 (0)