Exemplo n.º 1
0
 /**
  * @covers FR3D\LdapBundle\Ldap\LdapManager::findUserBy
  */
 public function testFindUserBy()
 {
     $username = '******';
     $ldapResponse = $this->ldapResponse($username);
     $this->driver->expects($this->once())->method('search')->with($this->equalTo('ou=Groups,dc=example,dc=com'), $this->equalTo('(&(attr0=value0)(uid=test_username))'), $this->equalTo(array('uid')))->will($this->returnValue($ldapResponse));
     $criteria = array('uid' => 'test_username');
     $resultUser = $this->ldapManager->findUserBy($criteria);
     $this->assertEquals($username, $resultUser->getUsername());
 }
Exemplo n.º 2
0
 /**
  * @covers FR3D\LdapBundle\Ldap\LdapManager::findUserBy
  */
 public function testFindUserBy()
 {
     $username = '******';
     $user = new TestUser();
     $user->setUsername($username);
     $entries = array('count' => 1, array('dn' => 'ou=group, dc=host, dc=foo', 'uid' => array('count' => 1, 0 => $username)));
     $this->connection->expects($this->once())->method('search')->with($this->equalTo('ou=Groups,dc=example,dc=com'), $this->equalTo('(&(attr0=value0)(uid=test_username))'), $this->equalTo(array('uid')))->will($this->returnValue($entries));
     $criteria = array('uid' => 'test_username');
     $resultUser = $this->ldapManager->findUserBy($criteria);
     $this->assertEquals($user->getUsername(), $resultUser->getUsername());
 }