split running of smbclient and libsmbclient backend tests

This commit is contained in:
Robin Appelman 2015-04-25 16:54:41 +02:00
commit 25c0dffdc7
8 changed files with 39 additions and 9 deletions

View file

@ -9,7 +9,7 @@ namespace Icewind\SMB\Test;
use Icewind\SMB\FileInfo;
abstract class AbstractShare extends \PHPUnit_Framework_TestCase {
abstract class AbstractShare extends TestCase {
/**
* @var \Icewind\SMB\Server $server
*/

View file

@ -11,6 +11,7 @@ use Icewind\SMB\NativeServer;
class NativeShare extends AbstractShare {
public function setUp() {
$this->requireBackendEnv('libsmbclient');
if (!function_exists('smbclient_state_new')) {
$this->markTestSkipped('libsmbclient php extension not installed');
}

View file

@ -9,7 +9,7 @@ namespace Icewind\SMB\Test;
use Icewind\SMB\NativeServer;
class NativeStream extends \PHPUnit_Framework_TestCase {
class NativeStream extends TestCase {
/**
* @var \Icewind\SMB\Server $server
*/
@ -28,6 +28,7 @@ class NativeStream extends \PHPUnit_Framework_TestCase {
protected $config;
public function setUp() {
$this->requireBackendEnv('libsmbclient');
if (!function_exists('smbclient_state_new')) {
$this->markTestSkipped('libsmbclient php extension not installed');
}

View file

@ -7,7 +7,7 @@
namespace Icewind\SMB\Test;
class Server extends \PHPUnit_Framework_TestCase {
class Server extends TestCase {
/**
* @var \Icewind\SMB\Server $server
*/
@ -16,6 +16,7 @@ class Server extends \PHPUnit_Framework_TestCase {
private $config;
public function setUp() {
$this->requireBackendEnv('smbclient');
$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);
}

View file

@ -11,6 +11,7 @@ use Icewind\SMB\Server as NormalServer;
class Share extends AbstractShare {
public function setUp() {
$this->requireBackendEnv('smbclient');
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
$this->server = new NormalServer($this->config->host, $this->config->user, $this->config->password);
$this->share = $this->server->getShare($this->config->share);

16
tests/TestCase.php Normal file
View file

@ -0,0 +1,16 @@
<?php
/**
* Copyright (c) 2015 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;
abstract class TestCase extends \PHPUnit_Framework_TestCase {
protected function requireBackendEnv($backend) {
if (getenv('BACKEND') and getenv('BACKEND') !== $backend) {
$this->markTestSkipped('Skipping tests for ' . $backend . ' backend');
}
}
}