Add more tests for stream

This commit is contained in:
Robin Appelman 2014-07-22 02:00:42 +02:00
commit 7035de036c
2 changed files with 117 additions and 9 deletions

View file

@ -303,19 +303,27 @@ class NativeShare implements IShare {
return fopen('nativesmb://dummy', 'r', false, $context);
}
/**
* Open a readable stream top a remote file
*
* @param string $source
* @return resource a read only stream with the contents of the remote file
*/
public function write($source) {
$handle = $this->create($source);
$context = stream_context_create(array(
'nativesmb' => array(
'state' => $this->state,
'handle' => $handle
)
));
return fopen('nativesmb://dummy', 'w', false, $context);
}
/**
* @return Server
*/
public function getServer() {
return $this->server;
}
public function __destruct() {
if ($this->state and is_resource($this->state)) {
self::registerErrorHandler();
smbclient_state_free($this->state);
restore_error_handler();
}
unset($this->state);
}
}