present() публичный Метод

Checks for the existence of an attribute.
public present ( $attribute ) : Wildcard
$attribute
Результат LdapTools\Query\Operator\Wildcard
Пример #1
0
 function it_should_query_results_from_multiple_schema_types($connection)
 {
     $foo = new LdapObjectSchema('foo', 'foo');
     $bar = new LdapObjectSchema('foo', 'bar');
     $foo->setFilter(new Comparison('foo', '=', 'bar'));
     $bar->setFilter(new Comparison('bar', '=', 'foo'));
     $map = ['firstName' => 'givenname', 'lastName' => 'sn', 'created' => 'whencreated', 'name' => 'cn'];
     $bar->setAttributeMap($map);
     $bar->setAttributesToSelect(['name', 'created']);
     $bar->setConverterMap(['generalized_time' => ['created']]);
     $foo->setAttributeMap($map);
     $foo->setAttributesToSelect(['firstName', 'lastName']);
     $fb = new FilterBuilder();
     $filter = new OperatorCollection();
     $filter->addLdapObjectSchema($foo);
     $filter->addLdapObjectSchema($bar);
     $filter->add($fb->bAnd($fb->startsWith('foo.firstName', 'J'), $fb->startsWith('bar.name', 'Smith'), $fb->present('lastName')));
     $this->operation->setFilter($filter);
     $this->operation->setAttributes([]);
     $connection->execute(Argument::that(function ($op) {
         return $op->getFilter() == '(&(foo=bar)(&(givenname=J*)(sn=*)))' && $op->getAttributes() == ['givenname', 'sn'];
     }))->shouldBeCalled()->willReturn($this->ldapEntries);
     $connection->execute(Argument::that(function ($op) {
         return $op->getFilter() == '(&(bar=foo)(&(cn=Smith*)(sn=*)))' && $op->getAttributes() == ['cn', 'whencreated'];
     }))->shouldBeCalled()->willReturn($this->sortEntries);
     $this->getResult()->count()->shouldBeEqualTo(4);
     $this->getArrayResult()->shouldHaveCount(4);
 }