/** * @covers CarnegieLearning\LdapOrmBundle\Ldap\Client::connect * @expectedException \CarnegieLearning\LdapOrmBundle\Exception\InvalidLdapConnectionException */ public function testConnectThrowsInvalidLdapConnectionException() { $coreMock = $this->getMockBuilder('\\CarnegieLearning\\LdapOrmBundle\\Ldap\\Core')->getMock(); $coreMock->expects($this->once())->method('connect')->will($this->returnValue(false)); $this->client->setLdap($coreMock); $this->client->connect(); $this->assertFalse($this->client->getLdapResource()); }
private function generateSequenceValue($dn) { $sr = ldap_search($this->client->getLdapResource(), $dn, '(objectClass=integerSequence)'); $infos = ldap_get_entries($this->client->getLdapResource(), $sr); $sequence = $infos[0]; $return = $sequence['nextvalue'][0]; $newValue = $sequence['nextvalue'][0] + $sequence['increment'][0]; $entry = array('nextvalue' => array($newValue)); ldap_modify($this->client->getLdapResource(), $dn, $entry); return $return; }