@@ -28,10 +28,61 @@ matrix:
2828# - env: GLPI_BRANCH=master
2929
3030before_script :
31- - " ./tests/before_script.sh"
31+ - |
32+ if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then
33+ mkdir ~/.composer -p
34+ touch ~/.composer/composer.json
35+ composer config -g github-oauth.github.com $GH_TOKEN
36+ fi
37+
38+ - # setup GLPI and its plugins
39+ - mysql -u root -e 'create database $DBNAME;'
40+ - mysql -u root -e 'create database $OLDDBNAME;'
41+ - git clone --depth=35 $GLPI_SOURCE -b $GLPI_BRANCH ../glpi && cd ../glpi
42+ - composer install --no-dev --no-interaction
43+ - mkdir -p tests/files/_cache
44+ - IFS=/ read -a repo <<< $TRAVIS_REPO_SLUG
45+ - mv ../${repo[1]} plugins/formcreator
46+
47+ - # prepare plugin to test
48+ - cd plugins/formcreator
49+ - composer install
3250
3351script :
34- - " ./tests/script.sh"
52+ - # setup code coverage
53+ - COVERAGE="-ncc"
54+ - if [ "${TRAVIS_PHP_VERSION:0:3}" = "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then COVERAGE="--nccfc CommonTreeDropdown CommonDropdown CommonDBTM CommonGLPI CommonDBChild CommonDBConnexity CommonDBRelation"; fi
55+
56+ - # install GLPI with an old schema of the plugin and upgrade it
57+ - export PASSWORDARG=""
58+ - if [ "$DBPASSWD" != "" ]; then export PASSWORDARG="-p$DBPASSWD"; fi
59+ - if [ -e ../../scripts/cliinstall.php ] && [ "$DBPASSWD" != "" ]; then DBPASSWDARG="--pass=$DBPASSWD"; fi
60+ - if [ -e ../../bin/console ] && [ "$DBPASSWD" != "" ]; then DBPASSWDARG="--db-password=$DBPASSWD"; fi
61+ - echo Installing GLPI on database $OLDDBNAME
62+ - rm ../../tests/files/_cache/cache_db/* ../../tests/files/_cache_/cache_trans/* ../../tests/files/_cache/*.json || true
63+ - rm ../../tests/config_db.php || true
64+ - if [ -e ../../scripts/cliinstall.php ]; then php ../../scripts/cliinstall.php --db=$OLDDBNAME --user=$DBUSER $DBPASSWDARG --tests ; fi
65+ - if [ -e ../../bin/console ]; then php ../../bin/console glpi:database:install --db-name=$OLDDBNAME --db-user=$DBUSER $DBPASSWDARG --config-dir=../../tests --no-interaction --no-plugins --force; fi
66+ - mysql -u $DBUSER $PASSWORDARG $OLDDBNAME < tests/plugin_formcreator_empty_2.5.0.sql
67+ - mysql -u $DBUSER $PASSWORDARG $OLDDBNAME < tests/plugin_formcreator_config_2.5.0.sql
68+ - # upgrade test
69+ - php scripts/cliinstall.php --tests
70+
71+ - # install GLPI with a fresh install of the plugin
72+ - if [ -e ../../scripts/cliinstall.php ] && [ "$DBPASSWD" != "" ]; then DBPASSWDARG="--pass=$DBPASSWD"; fi
73+ - if [ -e ../../bin/console ] && [ "$DBPASSWD" != "" ]; then DBPASSWDARG="--db-password=$DBPASSWD"; fi
74+ - echo Installing GLPI on database $DBNAME
75+ - rm ../../tests/files/_cache/cache_db/* ../../tests/files/_cache_/cache_trans/* ../../tests/files/_cache/*.json || true
76+ - rm ../../tests/config_db.php || true
77+ - if [ -e ../../scripts/cliinstall.php ]; then php ../../scripts/cliinstall.php --db=$DBNAME --user=$DBUSER $DBPASSWDARG --tests ; fi
78+ - if [ -e ../../bin/console ]; then php ../../bin/console glpi:database:install --db-name=$DBNAME --db-user=$DBUSER $DBPASSWDARG --config-dir=../../tests --no-interaction --no-plugins --force; fi
79+ - # fresh install test
80+ - ./vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-install -ncc
81+ - ./vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-integration $COVERAGE
82+ - ./vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-unit $COVERAGE
83+ - ./vendor/bin/atoum -ft -bf tests/bootstrap.php -d tests/suite-uninstall -ncc
84+ - ./vendor/bin/parallel-lint --exclude vendor .
85+ - if [ "${TRAVIS_PHP_VERSION:0:3}" = "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then vendor/bin/robo --no-interaction code:cs; fi
3586
3687after_success :
3788 # let's update the documentation and locales
0 commit comments