You are here

run-test.sh in File Cache 8

#!/bin/bash

# Run either PHPUnit tests or PHP_CodeSniffer tests on Travis CI, depending
# on the passed in parameter.

mysql_to_ramdisk() {
    sudo service mysql stop
    sudo mv /var/lib/mysql /var/run/tmpfs
    sudo ln -s /var/run/tmpfs /var/lib/mysql
    sudo service mysql start
}

TEST_DIRS=($MODULE_DIR/tests)

case "$1" in
    PHP_CodeSniffer)
        cd $MODULE_DIR
        ./vendor/bin/phpcs
        exit $?
        ;;
    *)
        mysql_to_ramdisk
        cd $DRUPAL_DIR
        EXIT=0
        for i in ${TEST_DIRS[@]}; do
            echo "Executing tests in $i"
            $TRAVIS_BUILD_DIR/vendor/bin/phpunit -c $DRUPAL_DIR/core/phpunit.xml.dist $i || EXIT=1
        done
        exit $EXIT
esac

File

scripts/travis-ci/run-test.sh
View source
  1. #!/bin/bash
  2. # Run either PHPUnit tests or PHP_CodeSniffer tests on Travis CI, depending
  3. # on the passed in parameter.
  4. mysql_to_ramdisk() {
  5. sudo service mysql stop
  6. sudo mv /var/lib/mysql /var/run/tmpfs
  7. sudo ln -s /var/run/tmpfs /var/lib/mysql
  8. sudo service mysql start
  9. }
  10. TEST_DIRS=($MODULE_DIR/tests)
  11. case "$1" in
  12. PHP_CodeSniffer)
  13. cd $MODULE_DIR
  14. ./vendor/bin/phpcs
  15. exit $?
  16. ;;
  17. *)
  18. mysql_to_ramdisk
  19. cd $DRUPAL_DIR
  20. EXIT=0
  21. for i in ${TEST_DIRS[@]}; do
  22. echo "Executing tests in $i"
  23. $TRAVIS_BUILD_DIR/vendor/bin/phpunit -c $DRUPAL_DIR/core/phpunit.xml.dist $i || EXIT=1
  24. done
  25. exit $EXIT
  26. esac