summaryrefslogtreecommitdiffstats
path: root/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
diff options
context:
space:
mode:
authorCharles Sarrazin <charles@sarraz.in>2016-01-28 14:54:41 +0100
committerCharles Sarrazin <charles@sarraz.in>2016-02-11 18:54:23 +0100
commita07df7b1ba2f304191e4b2232072f34475bd5bcc (patch)
tree5c14602213e50803d6ae1b50b83d2e8cccebc0fa /Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
parentb5c4b14ce46387314b6bd17f13ac151b446c6847 (diff)
downloadsymfony-security-a07df7b1ba2f304191e4b2232072f34475bd5bcc.zip
symfony-security-a07df7b1ba2f304191e4b2232072f34475bd5bcc.tar.gz
symfony-security-a07df7b1ba2f304191e4b2232072f34475bd5bcc.tar.bz2
Improved the Ldap Component
* Moved connection logic to dedicated class * Added support for Ldap result entries iterator and renamed LdapClient to Ldap * Added support for multiple adapters * Attempt anonymous bind if the connection is not bound beforehand * Finalized API * Updated the Security component to use v3.1 of the Ldap component * Updated unit tests * Added support for functional tests * Updated README file
Diffstat (limited to 'Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php')
-rw-r--r--Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php b/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
index 844bcef..4d2eead 100644
--- a/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
+++ b/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
@@ -11,10 +11,13 @@
namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
+use Symfony\Component\Ldap\LdapInterface;
use Symfony\Component\Security\Core\Authentication\Provider\LdapBindAuthenticationProvider;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Ldap\Exception\ConnectionException;
+use Symfony\Component\Security\Core\User\UserCheckerInterface;
+use Symfony\Component\Security\Core\User\UserProviderInterface;
/**
* @requires extension ldap
@@ -27,14 +30,14 @@ class LdapBindAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
*/
public function testBindFailureShouldThrowAnException()
{
- $userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
- $ldap = $this->getMock('Symfony\Component\Ldap\LdapClientInterface');
+ $userProvider = $this->getMock(UserProviderInterface::class);
+ $ldap = $this->getMock(LdapInterface::class);
$ldap
->expects($this->once())
->method('bind')
->will($this->throwException(new ConnectionException()))
;
- $userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
+ $userChecker = $this->getMock(UserCheckerInterface::class);
$provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap);
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
@@ -45,15 +48,15 @@ class LdapBindAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
public function testRetrieveUser()
{
- $userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
+ $userProvider = $this->getMock(UserProviderInterface::class);
$userProvider
->expects($this->once())
->method('loadUserByUsername')
->with('foo')
;
- $ldap = $this->getMock('Symfony\Component\Ldap\LdapClientInterface');
+ $ldap = $this->getMock(LdapInterface::class);
- $userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
+ $userChecker = $this->getMock(UserCheckerInterface::class);
$provider = new LdapBindAuthenticationProvider($userProvider, $userChecker, 'key', $ldap);
$reflection = new \ReflectionMethod($provider, 'retrieveUser');