You are here

run-tests.sh in CloudFlare 8

#!/bin/bash

# Copy the program into the drupal installation
mkdir -p docroot/modules/program && rsync -a . docroot/modules/program --exclude \".idea\" --exclude bin --exclude \".git\" --exclude \".gitignore\" --exclude docroot --exclude \"*.make\" --exclude \".travis.yml\" --exclude vendor && rm -fr modules/contrib themes/contrib

# Create required directories in docroot
mkdir -p docroot/profiles
mkdir -p docroot/themes

# move into docroot
cd docroot

# Run everything in a subshell so we can always cleanup
(
  # Exit on fail
  set -e

  # Run unit tests, this will complete very quickly and will catch early failures
  ../vendor/bin/phpunit --group=cloudflare --configuration=core/phpunit.xml.dist modules/program

  # Unit tests passed, boot up a full drupal and run tests
  ../vendor/bin/drush site-install standard --yes --account-pass=admin --db-url=mysql://root:@127.0.0.1/simpletest_db
  ../vendor/bin/drush config-set system.performance css.preprocess 0 --yes
  ../vendor/bin/drush config-set system.performance js.preprocess 0 --yes
  ../vendor/bin/drush config-set system.logging error_level all --yes
  ../vendor/bin/drush en simpletest cloudflare cloudflarepurger --yes

  # Boot up server and client
  ../vendor/bin/drush runserver --default-server=builtin 8888 > /dev/null &
  phantomjs --webdriver=4444 > /dev/null &

  # Run all tests
  php core/scripts/run-tests.sh --module cloudflare --php $(which php) --url http://localhost:8888/ --verbose
  php core/scripts/run-tests.sh --module cloudflarepurger --php $(which php) --url http://localhost:8888/ --verbose
)

# Store the exit status of the subcommand
exit_status=$?

# list jobs to kill
jobs -p

# kill drush server and phantomjs
pkill -P $$

# Exit with the exit status
exit $exit_status

File

run-tests.sh
View source
  1. #!/bin/bash
  2. # Copy the program into the drupal installation
  3. mkdir -p docroot/modules/program && rsync -a . docroot/modules/program --exclude \".idea\" --exclude bin --exclude \".git\" --exclude \".gitignore\" --exclude docroot --exclude \"*.make\" --exclude \".travis.yml\" --exclude vendor && rm -fr modules/contrib themes/contrib
  4. # Create required directories in docroot
  5. mkdir -p docroot/profiles
  6. mkdir -p docroot/themes
  7. # move into docroot
  8. cd docroot
  9. # Run everything in a subshell so we can always cleanup
  10. (
  11. # Exit on fail
  12. set -e
  13. # Run unit tests, this will complete very quickly and will catch early failures
  14. ../vendor/bin/phpunit --group=cloudflare --configuration=core/phpunit.xml.dist modules/program
  15. # Unit tests passed, boot up a full drupal and run tests
  16. ../vendor/bin/drush site-install standard --yes --account-pass=admin --db-url=mysql://root:@127.0.0.1/simpletest_db
  17. ../vendor/bin/drush config-set system.performance css.preprocess 0 --yes
  18. ../vendor/bin/drush config-set system.performance js.preprocess 0 --yes
  19. ../vendor/bin/drush config-set system.logging error_level all --yes
  20. ../vendor/bin/drush en simpletest cloudflare cloudflarepurger --yes
  21. # Boot up server and client
  22. ../vendor/bin/drush runserver --default-server=builtin 8888 > /dev/null &
  23. phantomjs --webdriver=4444 > /dev/null &
  24. # Run all tests
  25. php core/scripts/run-tests.sh --module cloudflare --php $(which php) --url http://localhost:8888/ --verbose
  26. php core/scripts/run-tests.sh --module cloudflarepurger --php $(which php) --url http://localhost:8888/ --verbose
  27. )
  28. # Store the exit status of the subcommand
  29. exit_status=$?
  30. # list jobs to kill
  31. jobs -p
  32. # kill drush server and phantomjs
  33. pkill -P $$
  34. # Exit with the exit status
  35. exit $exit_status