/** * Given the LDAP type, determine the BindStrategy to use. * * @param DomainConfiguration $config * @return ADBindUserStrategy|BindUserStrategy */ public static function getInstance(DomainConfiguration $config) { if (LdapConnection::TYPE_AD == $config->getLdapType()) { return new ADBindUserStrategy($config); } else { return new self($config); } }
function it_should_throw_a_SchemaParserException_when_the_schema_file_is_not_readable() { $fakePath = '/this/path/should/never/really/exist/I/would/hope'; $this->beConstructedWith($fakePath); $domain = new DomainConfiguration('example.com'); $domain->setLdapType('ad'); $this->shouldThrow(new SchemaParserException('Cannot find schema for "ad" in "' . $fakePath . '"'))->duringParse($domain->getLdapType(), 'user'); }
/** * {@inheritdoc} */ public function getDiagnosticMessage() { return LastErrorStrategy::getInstance($this->config->getLdapType(), $this->connection)->getDiagnosticMessage(); }