smb/tests/NativeShareTest.php
Andy Scherzinger 8acffcd855
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-06-02 20:28:14 +02:00

63 lines
1.5 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2014 Robin Appelman <robin@icewind.nl>
* SPDX-License-Identifier: MIT
*/
namespace Icewind\SMB\Test;
use Icewind\SMB\ACL;
use Icewind\SMB\BasicAuth;
use Icewind\SMB\Exception\InvalidArgumentException;
use Icewind\SMB\IOptions;
use Icewind\SMB\Native\NativeServer;
use Icewind\SMB\Options;
use Icewind\SMB\System;
use Icewind\SMB\TimeZoneProvider;
class NativeShareTest extends AbstractShareTest {
public function getServerClass(): string {
$this->requireBackendEnv('libsmbclient');
if (!function_exists('smbclient_state_new')) {
$this->markTestSkipped('libsmbclient php extension not installed');
}
return NativeServer::class;
}
public function testProtocolMatch() {
$options = new Options();
$options->setMinProtocol(IOptions::PROTOCOL_SMB2);
$options->setMaxProtocol(IOptions::PROTOCOL_SMB3);
$server = new NativeServer(
$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(InvalidArgumentException::class);
$options = new Options();
$options->setMaxProtocol(IOptions::PROTOCOL_NT1);
$server = new NativeServer(
$this->config->host,
new BasicAuth(
$this->config->user,
'test',
$this->config->password
),
new System(),
new TimeZoneProvider(new System()),
$options
);
$server->listShares();
}
}