mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Use PSR4 to autoload tests
This commit is contained in:
parent
e74a83a400
commit
3697e04c63
5 changed files with 14 additions and 11 deletions
52
tests/Server.php
Normal file
52
tests/Server.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace Icewind\SMB\Test;
|
||||
|
||||
class Server extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* @var \Icewind\SMB\Server $server
|
||||
*/
|
||||
private $server;
|
||||
|
||||
private $config;
|
||||
|
||||
public function setUp() {
|
||||
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
|
||||
$this->server = new \Icewind\SMB\Server($this->config->host, $this->config->user, $this->config->password);
|
||||
}
|
||||
|
||||
public function testListShares() {
|
||||
$shares = $this->server->listShares();
|
||||
foreach ($shares as $share) {
|
||||
if ($share->getName() === $this->config->share) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->fail('Share "' . $this->config->share . '" not found');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Icewind\SMB\AuthenticationException
|
||||
*/
|
||||
public function testWrongUserName() {
|
||||
$this->markTestSkipped('This fails for no reason on travis');
|
||||
$server = new \Icewind\SMB\Server($this->config->host, uniqid(), uniqid());
|
||||
$server->listShares();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Icewind\SMB\AuthenticationException
|
||||
*/
|
||||
public function testWrongPassword() {
|
||||
$server = new \Icewind\SMB\Server($this->config->host, $this->config->user, uniqid());
|
||||
$server->listShares();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Icewind\SMB\InvalidHostException
|
||||
*/
|
||||
public function testWrongHost() {
|
||||
$server = new \Icewind\SMB\Server(uniqid(), $this->config->user, $this->config->password);
|
||||
$server->listShares();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue