mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +02:00
make tests a bit more accepting of older server behavior
This commit is contained in:
parent
78d5468e32
commit
e4f0be4edb
1 changed files with 25 additions and 7 deletions
|
|
@ -10,6 +10,7 @@ namespace Icewind\SMB\Test;
|
||||||
use Icewind\SMB\BasicAuth;
|
use Icewind\SMB\BasicAuth;
|
||||||
use Icewind\SMB\Exception\AuthenticationException;
|
use Icewind\SMB\Exception\AuthenticationException;
|
||||||
use Icewind\SMB\Exception\ConnectionRefusedException;
|
use Icewind\SMB\Exception\ConnectionRefusedException;
|
||||||
|
use Icewind\SMB\Exception\InvalidHostException;
|
||||||
use Icewind\SMB\IOptions;
|
use Icewind\SMB\IOptions;
|
||||||
use Icewind\SMB\IShare;
|
use Icewind\SMB\IShare;
|
||||||
use Icewind\SMB\Options;
|
use Icewind\SMB\Options;
|
||||||
|
|
@ -52,7 +53,6 @@ class ServerTest extends TestCase {
|
||||||
|
|
||||||
public function testWrongUserName() {
|
public function testWrongUserName() {
|
||||||
$this->expectException(AuthenticationException::class);
|
$this->expectException(AuthenticationException::class);
|
||||||
$this->markTestSkipped('This fails for no reason on travis');
|
|
||||||
$server = new Server(
|
$server = new Server(
|
||||||
$this->config->host,
|
$this->config->host,
|
||||||
new BasicAuth(
|
new BasicAuth(
|
||||||
|
|
@ -84,7 +84,6 @@ class ServerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWrongHost() {
|
public function testWrongHost() {
|
||||||
$this->expectException(ConnectionRefusedException::class);
|
|
||||||
$server = new Server(
|
$server = new Server(
|
||||||
uniqid(),
|
uniqid(),
|
||||||
new BasicAuth(
|
new BasicAuth(
|
||||||
|
|
@ -96,11 +95,17 @@ class ServerTest extends TestCase {
|
||||||
new TimeZoneProvider(new System()),
|
new TimeZoneProvider(new System()),
|
||||||
new Options()
|
new Options()
|
||||||
);
|
);
|
||||||
$server->listShares();
|
try {
|
||||||
|
$server->listShares();
|
||||||
|
$this->fail("Expected exception");
|
||||||
|
} catch (ConnectionRefusedException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (InvalidHostException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHostEscape() {
|
public function testHostEscape() {
|
||||||
$this->expectException(ConnectionRefusedException::class);
|
|
||||||
$server = new Server(
|
$server = new Server(
|
||||||
$this->config->host . ';asd',
|
$this->config->host . ';asd',
|
||||||
new BasicAuth(
|
new BasicAuth(
|
||||||
|
|
@ -112,7 +117,14 @@ class ServerTest extends TestCase {
|
||||||
new TimeZoneProvider(new System()),
|
new TimeZoneProvider(new System()),
|
||||||
new Options()
|
new Options()
|
||||||
);
|
);
|
||||||
$server->listShares();
|
try {
|
||||||
|
$server->listShares();
|
||||||
|
$this->fail("Expected exception");
|
||||||
|
} catch (ConnectionRefusedException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (InvalidHostException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testProtocolMatch() {
|
public function testProtocolMatch() {
|
||||||
|
|
@ -135,7 +147,6 @@ class ServerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testToLowMaxProtocol() {
|
public function testToLowMaxProtocol() {
|
||||||
$this->expectException(ConnectionRefusedException::class);
|
|
||||||
$options = new Options();
|
$options = new Options();
|
||||||
$options->setMaxProtocol(IOptions::PROTOCOL_NT1);
|
$options->setMaxProtocol(IOptions::PROTOCOL_NT1);
|
||||||
$server = new Server(
|
$server = new Server(
|
||||||
|
|
@ -149,6 +160,13 @@ class ServerTest extends TestCase {
|
||||||
new TimeZoneProvider(new System()),
|
new TimeZoneProvider(new System()),
|
||||||
$options
|
$options
|
||||||
);
|
);
|
||||||
$server->listShares();
|
try {
|
||||||
|
$server->listShares();
|
||||||
|
$this->markTestSkipped("Server seems to accept NT1 connections");
|
||||||
|
} catch (ConnectionRefusedException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->fail("Wrong exception");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue