/** * Build the Entity Manager service * * @param Logger $logger * @param Reader $reader * @param Client $client */ public function __construct(Logger $logger, Reader $reader, Client $client) { $this->logger = $logger; $this->reader = $reader; $this->client = $client; $this->client->connect(); }
/** * @covers CarnegieLearning\LdapOrmBundle\Ldap\Client::connect * @expectedException \CarnegieLearning\LdapOrmBundle\Exception\InvalidLdapBindException */ public function testConnectThrowsInvalidLdapBindException() { $coreMock = $this->getMockBuilder('\\CarnegieLearning\\LdapOrmBundle\\Ldap\\Core')->getMock(); $coreMock->expects($this->once())->method('bind')->will($this->returnValue(false)); $coreMock->expects($this->once())->method('connect')->will($this->returnValue(null)); $this->client->setLdap($coreMock); $this->client->connect(); }