public function test_connect_Closes_IfConnectionCurrentlyOpen() { $this->addLdapConnectMethodMock(); LdapFunctions::$phpUnitMock->expects($this->exactly(1))->method('ldap_close')->withConsecutive(array($this->equalTo("connection_resource_hostname_1234")), array($this->equalTo("connection_resource_hostname2_4567"))); $ldapClient = new LdapClient("hostname", 1234); $this->assertTrue($ldapClient->isOpen()); $ldapClient->connect("hostname2", 4567); $this->assertTrue($ldapClient->isOpen()); }