/** * @param LdapObject $ldapObject * @param string|null $dn The DN to use for the batch operation to LDAP. */ protected function executeBatchOperation(LdapObject $ldapObject, $dn = null) { $dn = $dn ?: $ldapObject->get('dn'); $operation = new BatchModifyOperation($dn, $ldapObject->getBatchCollection()); $this->hydrateOperation($operation, $ldapObject->getType()); $this->connection->execute($operation); $ldapObject->setBatchCollection(new BatchCollection($ldapObject->get('dn'))); }
public function it_should_error_trying_to_do_a_non_set_method_on_many_aggregated_values($connection) { $ldapObject = new LdapObject(['dn' => 'cn=foo,dc=foo,dc=bar'], [], 'user', 'user'); $ldapObject->set('disabled', true); $ldapObject->add('trustedForAllDelegation', true); $batch = $ldapObject->getBatchCollection(); $connection->execute(Argument::that(function ($operation) { return $operation->getFilter() == '(&(objectClass=*))' && $operation->getBaseDn() == 'cn=foo,dc=foo,dc=bar' && $operation->getAttributes() == ['userAccountControl']; }))->willReturn($this->expectedResult); $this->beConstructedWith($this->schema, $batch, AttributeConverterInterface::TYPE_MODIFY); $this->setLdapConnection($connection); $this->setDn('cn=foo,dc=foo,dc=bar'); $this->shouldThrow(new \LogicException('Unable to modify "trustedForAllDelegation". The "ADD" action is not allowed.'))->duringToLdap(); }