/** * @expectedException Exception * @expectedExceptionMessage test */ public function test_doWithClient_PropagatesCallbackExceptions() { $mockLdapClient = $this->makeMockLdapClient($forSuccess = true); $this->ldapUsers->setLdapClientClass($mockLdapClient); $serverInfo = new ServerInfo("localhost", 389); $this->ldapUsers->setLdapServers(array($serverInfo)); $this->ldapUsers->doWithClient(function () { throw new Exception("test"); }); }