function it_should_hydrate_a_query_operation_to_ldap_with_a_schema($connection) { $this->schema->setBaseDn('dc=foo,dc=bar'); $this->setLdapObjectSchema($this->schema); $this->setOperationType(AttributeConverterInterface::TYPE_SEARCH_TO); $this->setLdapConnection($connection); $filter = new FilterBuilder(); $collection = new OperatorCollection(); $collection->add($filter->eq('firstName', 'foo')); $collection->add($filter->eq('lastName', 'bar')); $collection->add($filter->eq('exchangeHideFromGAL', false)); $collection->addLdapObjectSchema($this->schema); $operation = new QueryOperation($collection, ['foo']); $this->hydrateToLdap($operation)->getFilter()->shouldBeEqualTo('(&(&(objectCategory=person)(objectClass=user))(givenName=foo)(sn=bar)(msExchHideFromAddressLists=FALSE))'); $this->hydrateToLdap($operation)->getBaseDn()->shouldBeEqualTo('dc=foo,dc=bar'); }
function it_should_resolve_base_dn_parameters_when_querying_ldap($connection) { $schema = new LdapObjectSchema('ad', 'user'); $schema->setBaseDn('%_configurationnamingcontext_%'); $schema->setFilter(new Comparison('foo', '=', 'bar')); $this->operation->getFilter()->addLdapObjectSchema($schema); $this->operation->setBaseDn('%_configurationnamingcontext_%'); $connection->execute(Argument::that(function ($op) { return $op->getBaseDn() == 'cn=Configuration,dc=example,dc=local'; }))->willReturn($this->ldapEntries); $this->execute(); }