Skip to content
Permalink
Browse files

test: Cleanup vendor symlinks

  • Loading branch information...
lazyfrosch committed Dec 5, 2018
1 parent 1a8df12 commit 99a31468c9fb493f4a16505b90cac10f1ebc2b75
Showing with 29 additions and 15 deletions.
  1. +0 −5 .gitignore
  2. +2 −2 .travis.yml
  3. +5 −1 test/php/bootstrap.php
  4. +22 −7 test/setup_vendor.sh
@@ -9,11 +9,6 @@

# Testing - created by test/setup_vendor.sh
/vendor/
/Hamcrest*
/Mockery*
/Icinga
/Zend
/*.phar

# Exclude application log files
var/log/*
@@ -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'
@@ -18,7 +18,11 @@
}
// 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;
@@ -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

0 comments on commit 99a3146

Please sign in to comment.
You can’t perform that action at this time.