Use PSR4 to autoload tests

This commit is contained in:
Robin Appelman 2014-07-26 18:00:22 +02:00
commit 3697e04c63
5 changed files with 14 additions and 11 deletions

View file

@ -18,7 +18,8 @@
}, },
"autoload" : { "autoload" : {
"psr-4": { "psr-4": {
"Icewind\\SMB\\": "src/" "Icewind\\SMB\\": "src/",
"Icewind\\SMB\\Test\\": "tests/"
} }
} }
} }

View file

@ -1,8 +1,6 @@
<?php <?php
namespace SMB\Test; namespace Icewind\SMB\Test;
require_once 'share.php';
class NativeShare extends Share { class NativeShare extends Share {

View file

@ -1,6 +1,8 @@
<?php <?php
namespace SMB\Test; namespace Icewind\SMB\Test;
use Icewind\SMB\NativeServer;
class NativeStream extends \PHPUnit_Framework_TestCase { class NativeStream extends \PHPUnit_Framework_TestCase {
/** /**
@ -25,8 +27,8 @@ class NativeStream extends \PHPUnit_Framework_TestCase {
$this->markTestSkipped('libsmbclient php extension not installed'); $this->markTestSkipped('libsmbclient php extension not installed');
} }
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json')); $this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
$this->server = new \Icewind\SMB\NativeServer($this->config->host, $this->config->user, $this->config->password); $this->server = new NativeServer($this->config->host, $this->config->user, $this->config->password);
$this->share = new \Icewind\SMB\NativeShare($this->server, $this->config->share); $this->share = $this->server->getShare($this->config->share);
if ($this->config->root) { if ($this->config->root) {
$this->root = '/' . $this->config->root . '/' . uniqid(); $this->root = '/' . $this->config->root . '/' . uniqid();
} else { } else {

View file

@ -1,6 +1,6 @@
<?php <?php
namespace SMB\Test; namespace Icewind\SMB\Test;
class Server extends \PHPUnit_Framework_TestCase { class Server extends \PHPUnit_Framework_TestCase {
/** /**

View file

@ -1,6 +1,8 @@
<?php <?php
namespace SMB\Test; namespace Icewind\SMB\Test;
use Icewind\SMB\Server;
class Share extends \PHPUnit_Framework_TestCase { class Share extends \PHPUnit_Framework_TestCase {
/** /**
@ -22,8 +24,8 @@ class Share extends \PHPUnit_Framework_TestCase {
public function setUp() { public function setUp() {
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json')); $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); $this->server = new Server($this->config->host, $this->config->user, $this->config->password);
$this->share = new \Icewind\SMB\Share($this->server, $this->config->share); $this->share = $this->server->getShare($this->config->share);
if ($this->config->root) { if ($this->config->root) {
$this->root = '/' . $this->config->root . '/' . uniqid(); $this->root = '/' . $this->config->root . '/' . uniqid();
} else { } else {