/** * @expectedException PHPUnit_Framework_Error_Warning */ public function testClosedirDouble() { $state = smbclient_state_new(); smbclient_state_init($state, null, SMB_USER, SMB_PASS); $dir = smbclient_opendir($state, 'smb://' . SMB_HOST . '/' . SMB_SHARE); $this->assertTrue(smbclient_closedir($state, $dir)); $this->assertFalse(smbclient_closedir($state, $dir)); }
public function testOptionNTHash() { $state = smbclient_state_new(); if (smbclient_option_get($state, SMBCLIENT_OPT_USE_NT_HASH) === null) { smbclient_state_free($state); return; } smbclient_option_set($state, SMBCLIENT_OPT_USE_NT_HASH, true); // NTLM hash of 'password' generated at http://www.tobtu.com/lmntlm.php smbclient_state_init($state, null, SMB_USER, SMB_HASH); $dir = smbclient_opendir($state, 'smb://' . SMB_HOST . '/' . SMB_SHARE); while (($out = smbclient_readdir($state, $dir)) !== false) { } $this->assertTrue(is_resource($dir)); smbclient_closedir($state, $dir); smbclient_state_free($state); }
/** * @param $dir * @return bool */ public function closedir($dir) { $result = smbclient_closedir($this->state, $dir); $this->testResult($result, $dir); return $result; }