You are here

run-test.sh in Organic groups 8

#!/bin/bash

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

mysql_to_ramdisk() {
  echo " > Move MySQL datadir to RAM disk."
  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=($DRUPAL_DIR/modules/og/tests $DRUPAL_DIR/modules/og/og_ui/tests)

case "$1" in
    PHP_CodeSniffer)
        cd $MODULE_DIR
        composer install
        ./vendor/bin/phpcs
        exit $?
        ;;
    *)
        # Disable deprecations checking in Drupal 9.
        if [[ $1 == 9* ]]; then export SYMFONY_DEPRECATIONS_HELPER=disabled; fi

        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
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. echo " > Move MySQL datadir to RAM disk."
  6. sudo service mysql stop
  7. sudo mv /var/lib/mysql /var/run/tmpfs
  8. sudo ln -s /var/run/tmpfs /var/lib/mysql
  9. sudo service mysql start
  10. }
  11. TEST_DIRS=($DRUPAL_DIR/modules/og/tests $DRUPAL_DIR/modules/og/og_ui/tests)
  12. case "$1" in
  13. PHP_CodeSniffer)
  14. cd $MODULE_DIR
  15. composer install
  16. ./vendor/bin/phpcs
  17. exit $?
  18. ;;
  19. *)
  20. # Disable deprecations checking in Drupal 9.
  21. if [[ $1 == 9* ]]; then export SYMFONY_DEPRECATIONS_HELPER=disabled; fi
  22. mysql_to_ramdisk
  23. ln -s $MODULE_DIR $DRUPAL_DIR/modules/og
  24. cd $DRUPAL_DIR
  25. EXIT=0
  26. for i in ${TEST_DIRS[@]}; do
  27. echo " > Executing tests from $i"
  28. ./vendor/bin/phpunit -c ./core/phpunit.xml.dist $i || EXIT=1
  29. done
  30. exit $EXIT
  31. esac