diff --git a/.travis.yml b/.travis.yml index 36510a98f..0dccddc87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,10 +35,9 @@ services: - mysql before_script: - # Remove Xdebug as we don't need it and it causes "PHP Fatal error: Maximum - # function nesting level of '256' reached." - # We also don't care if that file exists or not on PHP 7. - - phpenv config-rm xdebug.ini || true + # Disable xdebug to increase performance. + - cp $HOME/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini /tmp + - phpenv config-rm xdebug.ini # Make sure Composer is up to date. - composer self-update @@ -48,7 +47,7 @@ before_script: # Navigate out of module directory to prevent blown stack by recursive module # lookup. - - cd .. + - cd ../../ # Create database. - mysql -e 'create database og' @@ -81,4 +80,17 @@ before_script: # Export database variable for kernel tests. - export SIMPLETEST_DB=mysql://root:@127.0.0.1/og -script: DRUPAL_DIR=$DRUPAL_DIR MODULE_DIR=$MODULE_DIR $MODULE_DIR/scripts/travis-ci/run-test.sh $TEST_SUITE + # Get the CodeClimate test reporter. + - test ${TEST_SUITE} != "8.8.x" || curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - test ${TEST_SUITE} != "8.8.x" || chmod +x ./cc-test-reporter + - test ${TEST_SUITE} != "8.8.x" || ./cc-test-reporter before-build + +script: + # Restore xdebug to support PHPUnit code coverage. + - test ${TEST_SUITE} != "8.8.x" || phpenv config-add /tmp/xdebug.ini + + # Run testsuite. + - DRUPAL_DIR=$DRUPAL_DIR MODULE_DIR=$MODULE_DIR $MODULE_DIR/scripts/travis-ci/run-test.sh $TEST_SUITE + +after_script: + - test ${TEST_SUITE} != "8.8.x" || ./cc-test-reporter after-build --coverage-input-type clover --exit-code $TRAVIS_TEST_RESULT diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 000000000..8b0f8112c --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ./tests/TestSuites/UnitTestSuite.php + + + ./tests/TestSuites/KernelTestSuite.php + + + ./tests/TestSuites/FunctionalTestSuite.php + + + ./tests/TestSuites/FunctionalJavascriptTestSuite.php + + + ./tests/TestSuites/BuildTestSuite.php + + + + + + + + + + + + + /home/travis/build/drupal/modules/og + + + ./ + + ./ + ./ + + + + diff --git a/scripts/travis-ci/run-test.sh b/scripts/travis-ci/run-test.sh index 07797a6a9..ff64bdafd 100755 --- a/scripts/travis-ci/run-test.sh +++ b/scripts/travis-ci/run-test.sh @@ -11,8 +11,6 @@ mysql_to_ramdisk() { sudo service mysql start } -TEST_DIRS=($DRUPAL_DIR/modules/og/tests $DRUPAL_DIR/modules/og/og_ui/tests) - case "$1" in PHP_CodeSniffer) cd $MODULE_DIR @@ -24,10 +22,8 @@ case "$1" in mysql_to_ramdisk ln -s $MODULE_DIR $DRUPAL_DIR/modules/og cd $DRUPAL_DIR - EXIT=0 - for i in ${TEST_DIRS[@]}; do - echo " > Executing tests from $i" - ./vendor/bin/phpunit -c ./core/phpunit.xml.dist $i || EXIT=1 - done - exit $EXIT + cp $DRUPAL_DIR/modules/og/phpunit.xml.dist ./core/phpunit.xml.dist + cat ./core/phpunit.xml.dist + ./vendor/bin/phpunit --coverage-clover "$TRAVIS_BUILD_DIR/build/logs/clover.xml" -c ./core/phpunit.xml.dist + exit $? esac