mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
split running of smbclient and libsmbclient backend tests
This commit is contained in:
parent
53fe7f2a44
commit
25c0dffdc7
8 changed files with 39 additions and 9 deletions
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
16
tests/TestCase.php
Normal 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue