mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +02:00
57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
|
|
* This file is licensed under the Licensed under the MIT license:
|
|
* http://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
namespace Icewind\SMB\Test;
|
|
|
|
use Icewind\SMB\BasicAuth;
|
|
use Icewind\SMB\System;
|
|
use Icewind\SMB\TimeZoneProvider;
|
|
use Icewind\SMB\Wrapped\Server as NormalServer;
|
|
|
|
class ShareTest extends AbstractShareTest {
|
|
public function setUp() {
|
|
$this->requireBackendEnv('smbclient');
|
|
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
|
|
$this->server = new NormalServer(
|
|
$this->config->host,
|
|
new BasicAuth(
|
|
$this->config->user,
|
|
'test',
|
|
$this->config->password
|
|
),
|
|
new System(),
|
|
new TimeZoneProvider($this->config->host, new System())
|
|
);
|
|
$this->share = $this->server->getShare($this->config->share);
|
|
if ($this->config->root) {
|
|
$this->root = '/' . $this->config->root . '/' . uniqid();
|
|
} else {
|
|
$this->root = '/' . uniqid();
|
|
}
|
|
$this->share->mkdir($this->root);
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Icewind\SMB\Exception\ConnectException
|
|
*/
|
|
public function testHostEscape() {
|
|
$this->requireBackendEnv('smbclient');
|
|
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
|
|
$this->server = new NormalServer(
|
|
$this->config->host . ';asd',
|
|
new BasicAuth(
|
|
$this->config->user,
|
|
'test',
|
|
$this->config->password
|
|
),
|
|
new System(),
|
|
new TimeZoneProvider($this->config->host, new System())
|
|
);
|
|
$share = $this->server->getShare($this->config->share);
|
|
$share->dir($this->root);
|
|
}
|
|
}
|