mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Make test configurable
This commit is contained in:
parent
2be5320595
commit
fc12434d28
2 changed files with 16 additions and 5 deletions
6
tests/config.json
Normal file
6
tests/config.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"host": "localhost",
|
||||
"user": "test",
|
||||
"password": "test",
|
||||
"share": "test"
|
||||
}
|
||||
|
|
@ -16,25 +16,30 @@ class Test extends PHPUnit_Framework_TestCase {
|
|||
*/
|
||||
private $root;
|
||||
|
||||
private $config;
|
||||
|
||||
public function setUp() {
|
||||
$this->server = new SMB\Server('localhost', 'test', 'test');
|
||||
$this->share = $this->server->getShare('test');
|
||||
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
|
||||
$this->server = new SMB\Server($this->config->host, $this->config->user, $this->config->password);
|
||||
$this->share = $this->server->getShare($this->config->share);
|
||||
$this->root = '/' . uniqid();
|
||||
$this->share->mkdir($this->root);
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
$this->share->rmdir($this->root);
|
||||
if ($this->share) {
|
||||
$this->share->rmdir($this->root);
|
||||
}
|
||||
}
|
||||
|
||||
public function testListShares() {
|
||||
$shares = $this->server->listShares();
|
||||
foreach ($shares as $share) {
|
||||
if ($share->getName() === 'test') {
|
||||
if ($share->getName() === $this->config->share) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->fail('Share "test" not found');
|
||||
$this->fail('Share "' . $this->config->share . '" not found');
|
||||
}
|
||||
|
||||
public function testDirectory() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue