Add travis testing
This commit is contained in:
parent
df04c0f837
commit
593fd485f6
|
@ -4,6 +4,16 @@
|
|||
# Except those related to git and vagrant
|
||||
!.git*
|
||||
!.puppet*
|
||||
!.travis.yml
|
||||
!.mailmap
|
||||
|
||||
# Testing - created by test/setup_vendor.sh
|
||||
/vendor/
|
||||
/Hamcrest*
|
||||
/Mockery*
|
||||
/Icinga
|
||||
/Zend
|
||||
/*.phar
|
||||
|
||||
# Exclude application log files
|
||||
var/log/*
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
language: php
|
||||
#dist: trusty
|
||||
sudo: required
|
||||
|
||||
php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
|
||||
services:
|
||||
- mysql
|
||||
- postgresql
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- vendor
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^v\d/
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
# also see: test/setup_vendor.sh
|
||||
before_script:
|
||||
- sudo locale-gen en_US.UTF-8 de_DE.UTF-8 fr_FR.UTF-8
|
||||
- test/travis_database.sh
|
||||
- test/setup_vendor.sh
|
||||
|
||||
script:
|
||||
# also see: modules/test/application/clicommands/PhpCommand.php
|
||||
# phpcs is disabled until fixed...
|
||||
# - php phpcs.phar -p --standard=icingaweb2.ruleset.xml --extensions=php --encoding=utf-8 application/ library/Icinga modules/ test/
|
||||
- php phpunit.phar -c modules/test/phpunit.xml --verbose
|
|
@ -1,5 +1,8 @@
|
|||
# Icinga Web 2
|
||||
|
||||
[![Build Status](https://travis-ci.org/Icinga/icingaweb2.png?branch=master)](https://travis-ci.org/Icinga/icingaweb2)
|
||||
[![Github Tag](https://img.shields.io/github/tag/Icinga/icingaweb2.svg)](https://github.com/Icinga/icingaweb2)
|
||||
|
||||
![Icinga Logo](https://www.icinga.com/wp-content/uploads/2014/06/icinga_logo.png)
|
||||
|
||||
1. [About](#about)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!-- PHP Codesniffer ruleset configuration -->
|
||||
<?xml version="1.0"?>
|
||||
<!-- PHP Codesniffer ruleset configuration -->
|
||||
<ruleset name="icingaweb2">
|
||||
<description>The default PSR-2 standard with specifically excluded non-critical sniffs</description>
|
||||
<!-- Include the whole PSR-2 standard -->
|
||||
|
|
|
@ -26,6 +26,10 @@ $mockeryLoader->register();
|
|||
|
||||
require_once($icingaLibPath . '/Test/ClassLoader.php');
|
||||
|
||||
if (! class_exists('PHPUnit_Framework_TestCase')) {
|
||||
require_once __DIR__ . '/phpunit-compat.php';
|
||||
}
|
||||
|
||||
$loader = new Icinga\Test\ClassLoader();
|
||||
$loader->registerNamespace('Tests', $testLibraryPath);
|
||||
$loader->registerNamespace('Icinga', $icingaLibPath);
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* @codingStandardsIgnoreStart
|
||||
*/
|
||||
class PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
}
|
||||
|
||||
interface PHPUnit_Framework_Test extends \PHPUnit\Framework\Test
|
||||
{
|
||||
}
|
||||
|
||||
interface PHPUnit_Framework_TestListener extends \PHPUnit\Framework\TestListener
|
||||
{
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
ICINGAWEB_HOME=${ICINGAWEB_HOME:="$(dirname "$(readlink -f $(dirname "$0"))")"}
|
||||
PHP_VERSION="$(php -r 'echo phpversion();')"
|
||||
PHPCS_VERSION=${PHPCS_VERSION:=2.9.1}
|
||||
MOCKERY_VERSION=${MOCKERY_VERSION:=0.9.9}
|
||||
HAMCREST_VERSION=${HAMCREST_VERSION:=2.0.0}
|
||||
|
||||
if [ "$PHP_VERSION" '<' 5.6.0 ]; then
|
||||
PHPUNIT_VERSION=${PHPUNIT_VERSION:=4.8}
|
||||
else
|
||||
PHPUNIT_VERSION=${PHPUNIT_VERSION:=5.7}
|
||||
fi
|
||||
|
||||
cd ${ICINGAWEB_HOME}
|
||||
|
||||
test -d vendor || mkdir vendor
|
||||
|
||||
# phpunit
|
||||
phpunit_path="vendor/phpunit-${PHPUNIT_VERSION}"
|
||||
if [ ! -e "${phpunit_path}".phar ]; then
|
||||
wget -O "${phpunit_path}".phar https://phar.phpunit.de/phpunit-${PHPUNIT_VERSION}.phar
|
||||
fi
|
||||
ln -svf "${phpunit_path}".phar phpunit.phar
|
||||
|
||||
# phpcs
|
||||
phpcs_path="vendor/phpcs-${PHPCS_VERSION}"
|
||||
if [ ! -e "${phpcs_path}".phar ]; then
|
||||
wget -O "${phpcs_path}".phar \
|
||||
https://github.com/squizlabs/PHP_CodeSniffer/releases/download/${PHPCS_VERSION}/phpcs.phar
|
||||
fi
|
||||
ln -svf "${phpcs_path}".phar phpcs.phar
|
||||
|
||||
# mockery
|
||||
mockery_path="vendor/mockery-${MOCKERY_VERSION}"
|
||||
if [ ! -e "${mockery_path}".tar.gz ]; then
|
||||
wget -O "${mockery_path}".tar.gz \
|
||||
https://github.com/mockery/mockery/archive/${MOCKERY_VERSION}.tar.gz
|
||||
fi
|
||||
if [ ! -d "${mockery_path}" ]; then
|
||||
tar xf "${mockery_path}".tar.gz -C vendor/
|
||||
fi
|
||||
ln -svf "${mockery_path}"/library/Mockery
|
||||
ln -svf "${mockery_path}"/library/Mockery.php
|
||||
|
||||
# hamcrest
|
||||
hamcrest_path="vendor/hamcrest-php-${HAMCREST_VERSION}"
|
||||
if [ ! -e "${hamcrest_path}".tar.gz ]; then
|
||||
wget -O "${hamcrest_path}".tar.gz \
|
||||
https://github.com/hamcrest/hamcrest-php/archive/v${HAMCREST_VERSION}.tar.gz
|
||||
fi
|
||||
if [ ! -d "${hamcrest_path}" ]; then
|
||||
tar xf "${hamcrest_path}".tar.gz -C vendor/
|
||||
fi
|
||||
ln -svf "${hamcrest_path}"/hamcrest/Hamcrest
|
||||
ln -svf "${hamcrest_path}"/hamcrest/Hamcrest.php
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
mysql -u root -e "GRANT ALL ON *.* TO icinga_unittest@localhost IDENTIFIED BY 'icinga_unittest'"
|
||||
|
||||
export PGHOST=localhost
|
||||
export PGUSER=postgres
|
||||
|
||||
psql -c "CREATE USER icinga_unittest WITH PASSWORD 'icinga_unittest'"
|
||||
psql -c "CREATE DATABASE icinga_unittest WITH OWNER icinga_unittest"
|
Loading…
Reference in New Issue