diff options
-rw-r--r-- | .travis.yml | 59 | ||||
-rw-r--r-- | tests/bootstrap.php | 15 | ||||
-rw-r--r-- | tests/phpunit.xml | 27 |
3 files changed, 77 insertions, 24 deletions
diff --git a/.travis.yml b/.travis.yml index af69e92e6..dc8440ec2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,34 +1,45 @@ -# see http://about.travis-ci.org/docs/user/languages/php/ for more hints language: php - -# list any PHP version you want to test against php: - # using major version aliases - - # aliased to a recent 5.3.x version - 5.3 - # aliased to a recent 5.4.x version - 5.4 - # aliased to a recent 5.5.x version - 5.5 -# optionally specify a list of environments, for example to test different RDBMS -#env: -# - DB=mysql -# - DB=pgsql +env: + global: + - CORE_BRANCH=master + matrix: + - DB=sqlite + +branches: + only: + - master + - stable7 + +before_install: + - wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh + - bash ./before_install.sh mail $CORE_BRANCH $DB -# execute any number of scripts before the test run, custom env's are available as variables -#before_script: -# - if [[ "$DB" == "pgsql" ]]; then psql -c "DROP DATABASE IF EXISTS hello_world_test;" -U postgres; fi -# - if [[ "$DB" == "pgsql" ]]; then psql -c "create database hello_world_test;" -U postgres; fi -# - if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS hello_world_test;" -uroot; fi +script: + # Test lint + - cd ../core/apps/mail + - sh -c "if [ '$DB' = 'sqlite' ]; then ant test; fi" -# omitting "script:" will default to phpunit -# use the $DB env variable to determine the phpunit.xml to use -#script: phpunit --configuration phpunit_$DB.xml --coverage-text -script: ant test + # Run phpunit tests + - cd tests + - phpunit --configuration phpunit.xml -# configure notifications (email, IRC, campfire etc) -#notifications: -# irc: "irc.freenode.org#travis" + # Create coverage report + - wget https://scrutinizer-ci.com/ocular.phar + - php ocular.phar code-coverage:upload --format=php-clover clover.xml +matrix: + include: + - php: 5.4 + env: DB=mysql + - php: 5.4 + env: DB=pgsql + - php: 5.4 + env: DB=oracle + allow_failures: + - php: hhvm + fast_finish: true diff --git a/tests/bootstrap.php b/tests/bootstrap.php index e69de29bb..57bf2fa0e 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -0,0 +1,15 @@ +<?php + +global $RUNTIME_NOAPPS; +$RUNTIME_NOAPPS = true; + +define('PHPUNIT_RUN', 1); + +require_once __DIR__.'/../../../lib/base.php'; + +if(!class_exists('PHPUnit_Framework_TestCase')) { + require_once('PHPUnit/Autoload.php'); +} + +OC_Hook::clear(); +OC_Log::$enabled = false; diff --git a/tests/phpunit.xml b/tests/phpunit.xml index e69de29bb..c94e34786 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8" ?> +<phpunit bootstrap="bootstrap.php" + strict="true" + verbose="true" + timeoutForSmallTests="900" + timeoutForMediumTests="900" + timeoutForLargeTests="900" + > + <testsuite name='ownCloud - Activity App Tests'> + <directory suffix='test.php'>.</directory> + </testsuite> + <!-- filters for code coverage --> + <filter> + <whitelist> + <directory suffix=".php">../../mail</directory> + <exclude> + <directory suffix=".php">../../mail/l10n</directory> + <directory suffix=".php">../../mail/tests</directory> + </exclude> + </whitelist> + </filter> + <logging> + <!-- and this is where your report will be written --> + <log type="coverage-clover" target="./clover.xml"/> + </logging> +</phpunit> + |