diff --git a/.gitignore b/.gitignore index 5c654a7ba..affd22ffb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,11 +9,6 @@ # Testing - created by test/setup_vendor.sh /vendor/ -/Hamcrest* -/Mockery* -/Icinga -/Zend -/*.phar # Exclude application log files var/log/* diff --git a/.travis.yml b/.travis.yml index 934d9ef7b..5a8902570 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,6 +58,6 @@ before_script: script: # also see: modules/test/application/clicommands/PhpCommand.php - - 'if [ "$CHECK" = phpcs ]; then php phpcs.phar; fi' - - 'if [ "$CHECK" = phpunit ]; then php phpunit.phar -c modules/test/phpunit.xml --verbose; fi' + - 'if [ "$CHECK" = phpcs ]; then php vendor/phpcs.phar; fi' + - 'if [ "$CHECK" = phpunit ]; then php vendor/phpunit.phar -c modules/test/phpunit.xml --verbose; fi' - 'if [ "$CHECK" = syntax ]; then php test/check-syntax.php -e "^(\./)?vendor/" -e Icinga/Util/String.php; fi' diff --git a/test/php/bootstrap.php b/test/php/bootstrap.php index 6e3345c14..38c092fee 100644 --- a/test/php/bootstrap.php +++ b/test/php/bootstrap.php @@ -18,7 +18,11 @@ if (!defined('ICINGA_LIBDIR')) { } // This is needed to get the Zend Plugin loader working -set_include_path(implode(PATH_SEPARATOR, array($libraryPath, get_include_path()))); +set_include_path(implode(PATH_SEPARATOR, [ + $libraryPath, + $basePath . DIRECTORY_SEPARATOR . 'vendor', + get_include_path() +])); require_once 'Mockery/Loader.php'; $mockeryLoader = new \Mockery\Loader; diff --git a/test/setup_vendor.sh b/test/setup_vendor.sh index 2fb074123..a7e9f08f3 100755 --- a/test/setup_vendor.sh +++ b/test/setup_vendor.sh @@ -11,48 +11,63 @@ PHPUNIT_VERSION=${PHPUNIT_VERSION:=5.7} cd "${ICINGAWEB_HOME}" test -d vendor || mkdir vendor +cd vendor/ + +del_old_link() { + if [ -L "$1" ]; then + rm "$1" + fi +} # phpunit -phpunit_path="vendor/phpunit-${PHPUNIT_VERSION}" +phpunit_path="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 +del_old_link ../phpunit.phar # phpcs -phpcs_path="vendor/phpcs-${PHPCS_VERSION}" +phpcs_path="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 -phpcbf_path="vendor/phpcbf-${PHPCS_VERSION}" +del_old_link ../phpcs.phar + +phpcbf_path="phpcbf-${PHPCS_VERSION}" if [ ! -e "${phpcbf_path}".phar ]; then wget -O "${phpcbf_path}".phar \ https://github.com/squizlabs/PHP_CodeSniffer/releases/download/${PHPCS_VERSION}/phpcbf.phar fi ln -svf "${phpcbf_path}".phar phpcbf.phar +del_old_link ../phpcbf.phar # mockery -mockery_path="vendor/mockery-${MOCKERY_VERSION}" +mockery_path="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/ + tar xf "${mockery_path}".tar.gz fi ln -svf "${mockery_path}"/library/Mockery Mockery ln -svf "${mockery_path}"/library/Mockery.php Mockery.php +del_old_link ../Mockery +del_old_link ../Mockery.php # hamcrest -hamcrest_path="vendor/hamcrest-php-${HAMCREST_VERSION}" +hamcrest_path="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/ + tar xf "${hamcrest_path}".tar.gz fi ln -svf "${hamcrest_path}"/hamcrest/Hamcrest Hamcrest ln -svf "${hamcrest_path}"/hamcrest/Hamcrest.php Hamcrest.php +del_old_link ../Hamcrest +del_old_link ../Hamcrest.php