mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Merge pull request #30 from icewind1991/travis-matrix
split running of smbclient and libsmbclient backend tests
This commit is contained in:
commit
21222508c0
8 changed files with 39 additions and 9 deletions
14
.travis.yml
14
.travis.yml
|
|
@ -6,6 +6,9 @@ php:
|
|||
- 5.6
|
||||
- 7.0
|
||||
|
||||
env:
|
||||
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: 7.0
|
||||
|
|
@ -13,17 +16,16 @@ matrix:
|
|||
env:
|
||||
global:
|
||||
- CURRENT_DIR=`pwd`
|
||||
matrix:
|
||||
- BACKEND=smbclient
|
||||
- BACKEND=libsmbclient
|
||||
|
||||
before_install:
|
||||
- pass=$(perl -e 'print crypt("test", "password")')
|
||||
- sudo useradd -m -p $pass test
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install samba smbclient libsmbclient-dev libsmbclient
|
||||
- wget -O /tmp/libsmbclient-php.zip https://github.com/eduardok/libsmbclient-php/archive/master.zip
|
||||
- unzip /tmp/libsmbclient-php.zip -d /tmp
|
||||
- cd /tmp/libsmbclient-php-master
|
||||
- phpize && ./configure && make && sudo make install
|
||||
- echo 'extension="libsmbclient.so"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- sudo apt-get install samba smbclient
|
||||
- if [ "$BACKEND" == 'libsmbclient' ]; then ./install_libsmbclient.sh; fi
|
||||
- cd $CURRENT_DIR
|
||||
- chmod go+w $HOME
|
||||
- printf "%s\n%s\n" test test|sudo smbpasswd -s test
|
||||
|
|
|
|||
8
install_libsmbclient.sh
Executable file
8
install_libsmbclient.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
sudo apt-get install libsmbclient-dev libsmbclient
|
||||
wget -O /tmp/libsmbclient-php.zip https://github.com/eduardok/libsmbclient-php/archive/master.zip
|
||||
unzip /tmp/libsmbclient-php.zip -d /tmp
|
||||
cd /tmp/libsmbclient-php-master
|
||||
phpize && ./configure && make && sudo make install
|
||||
echo 'extension="libsmbclient.so"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
|
|
@ -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