function it_should_hydrate_a_ldap_object_wihtout_a_schema_with_batch_modification() { $ldapObject = new LdapObject(['dn' => 'cn=foo,dc=foo,dc=bar'], [], 'user', ''); $ldapObject->set('givenName', 'Chad'); $ldapObject->add('sn', 'Sikorra'); $ldapObject->remove('sAMAccountName', 'csikorra'); $ldapObject->reset('mail'); $this->hydrateToLdap($ldapObject)->shouldBeEqualTo($this->batch); $this->hydrateToLdap($ldapObject)->shouldHaveCount(4); }
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(); }
function it_should_persist_an_ldap_object_that_has_no_schema_type($connection) { $dn = 'cn=user,dc=foo,dc=bar'; $ldapObject = new LdapObject(['dn' => $dn]); $ldapObject->set('foo', 'bar'); $batch = new BatchCollection($dn); $batch->add(new Batch(Batch::TYPE['REPLACE'], 'foo', 'bar')); $connection->execute(new BatchModifyOperation($dn, $batch))->shouldBeCalled(); $this->persist($ldapObject); }