allow setting protocol levels

This commit is contained in:
Robin Appelman 2021-03-02 21:20:17 +01:00
commit 61012e6196
9 changed files with 149 additions and 60 deletions

View file

@ -10,7 +10,7 @@ namespace Icewind\SMB\Test;
use Icewind\SMB\BasicAuth;
use Icewind\SMB\Exception\AuthenticationException;
use Icewind\SMB\Exception\ConnectionRefusedException;
use Icewind\SMB\Exception\InvalidHostException;
use Icewind\SMB\IOptions;
use Icewind\SMB\IShare;
use Icewind\SMB\Options;
use Icewind\SMB\System;
@ -114,4 +114,41 @@ class ServerTest extends TestCase {
);
$server->listShares();
}
public function testProtocolMatch() {
$options = new Options();
$options->setMinProtocol(IOptions::PROTOCOL_SMB2);
$options->setMaxProtocol(IOptions::PROTOCOL_SMB3);
$server = new Server(
$this->config->host,
new BasicAuth(
$this->config->user,
'test',
$this->config->password
),
new System(),
new TimeZoneProvider(new System()),
$options
);
$server->listShares();
$this->assertTrue(true);
}
public function testToLowMaxProtocol() {
$this->expectException(ConnectionRefusedException::class);
$options = new Options();
$options->setMaxProtocol(IOptions::PROTOCOL_NT1);
$server = new Server(
$this->config->host,
new BasicAuth(
$this->config->user,
'test',
$this->config->password
),
new System(),
new TimeZoneProvider(new System()),
$options
);
$server->listShares();
}
}