function it_should_select_get_the_correct_attributes_to_select_based_off_the_alias_in_use($connection)
{
$this->setLdapConnection($connection);
$gSchema = $this->parser->parse('ad', 'group');
$operators = new OperatorCollection();
$operators->addLdapObjectSchema($this->schema, 'u');
$operators->addLdapObjectSchema($gSchema, 'g');
$operationSelect = new QueryOperation($operators);
$operationDefault = clone $operationSelect;
$operationSelect->setAttributes(['u.firstName', 'u.lastName', 'name', 'g.description', 'g.members']);
$operationDefault->setAttributes(['g.name', 'g.description']);
// Only the specifically selected attributes for the alias, in addition to the generic name attribute.
$this->setLdapObjectSchema($this->schema);
$this->setAlias('u');
$this->hydrateToLdap(clone $operationSelect)->getAttributes()->shouldBeEqualTo(['givenName', 'sn', 'cn']);
// Only the specifically selected attributes, in addition to the generic name attribute.
$this->setLdapObjectSchema($gSchema);
$this->setAlias('g');
$this->hydrateToLdap(clone $operationSelect)->getAttributes()->shouldBeEqualTo(['cn', 'description', 'member']);
// Check that defaults for a given alias are selected if non specifically are for that alias.
$this->setLdapObjectSchema($this->schema);
$this->setAlias('u');
$this->hydrateToLdap(clone $operationDefault)->getAttributes()->shouldBeEqualTo(['cn', 'givenName', 'sn', 'sAMAccountName', 'mail', 'distinguishedName', 'objectGuid']);
}