Skip to content

Commit

Permalink
add travis support
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Aug 31, 2015
1 parent eaf35fb commit 30d31e2
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
tests/config.json
tests/clover.xml
vendor
composer.lock
51 changes: 51 additions & 0 deletions .travis.yml
@@ -0,0 +1,51 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm

env:
global:
- CORE_BRANCH=master
- APP_NAME=files_external_ftp
- DB=sqlite
matrix:
- FTPD=pure-ftpd
- FTPD=proftpd
- FTPD=vsftpd

before_install:
- sudo apt-get update -qq
- sudo apt-get install -yqq bc $FTPD
- sudo /etc/init.d/$FTPD restart
- if [ "$FTPD" = "vsftpd" ]; then echo "local_enable=YES" | sudo tee -a /etc/vsftpd.conf; echo "write_enable=YES" | sudo tee -a /etc/vsftpd.conf; fi
- sudo /etc/init.d/$FTPD restart

- pass=$(perl -e 'print crypt("test", "password")')
- sudo useradd -m -p $pass test

- wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../core
- php occ app:enable $APP_NAME

script:
# Test lint
- cd ../core/apps/$APP_NAME
- find . -name \*.php -exec php -l "{}" \;

# Run phpunit tests
- cd tests
- echo '{"host":"localhost","username":"test","password":"test"}' > config.json
- phpunit --configuration phpunit.xml

# Create coverage report
- sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then php ocular.phar code-coverage:upload --format=php-clover clover.xml; fi"

matrix:
allow_failures:
- php: hhvm
fast_finish: true
11 changes: 11 additions & 0 deletions tests/bootstrap.php
@@ -0,0 +1,11 @@
<?php

define('PHPUNIT_RUN', 1);

require_once __DIR__ . '/../../../lib/base.php';

if (!class_exists('PHPUnit_Framework_TestCase')) {
require_once('PHPUnit/Autoload.php');
}

OC_Hook::clear();
4 changes: 3 additions & 1 deletion tests/ftp.php
Expand Up @@ -41,7 +41,9 @@ protected function setUp() {
}

protected function tearDown() {
$this->instance->disconnect();
if ($this->instance) {
$this->instance->disconnect();
}
parent::tearDown();
}

Expand Down
26 changes: 26 additions & 0 deletions tests/phpunit.xml
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit bootstrap="bootstrap.php"
strict="true"
verbose="true"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
>
<testsuite name='ownCloud - file external ftp App Tests'>
<directory suffix='.php'>.</directory>
</testsuite>
<!-- filters for code coverage -->
<filter>
<whitelist>
<directory suffix=".php">../../files_external_ftp</directory>
<exclude>
<directory suffix=".php">../../files_external_ftp/tests</directory>
</exclude>
</whitelist>
</filter>
<logging>
<!-- and this is where your report will be written -->
<log type="coverage-clover" target="./clover.xml"/>
</logging>
</phpunit>

0 comments on commit 30d31e2

Please sign in to comment.