/** * @covers CarnegieLearning\LdapOrmBundle\Ldap\Client::connect * @expectedException \CarnegieLearning\LdapOrmBundle\Exception\InvalidLdapTlsConnectionException */ public function testConnectThrowsInvalidLdapTlsConnectionException() { $coreMock = $this->getMockBuilder('\\CarnegieLearning\\LdapOrmBundle\\Ldap\\Core')->getMock(); $coreMock->expects($this->once())->method('startTls')->will($this->returnValue(false)); $coreMock->expects($this->once())->method('connect')->will($this->returnValue(null)); $this->client->setUseTls(true); $this->client->setLdap($coreMock); $this->client->connect(); }