-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-tests.sh
executable file
·39 lines (32 loc) · 1.34 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
##
# Run all tests!
RESULT=0
# Fix ownership of code base.
docker exec -t drupal bash -c "chown -R docker:docker /var/www/html"
# Ensure everything is up to date.
docker exec -u docker -t drupal bash -c "cd /var/www/html && composer install"
# Coding standards checks.
echo "Checking coding standards"
docker exec -t drupal bash -c "cd /var/www/html && ./bin/phpcs -p"
if [ $? -ne 0 ]; then
((RESULT++))
fi
# Deprecated code checks.
echo "Checking for deprecated code"
docker exec -t drupal bash -c "cd /var/www/html && ./bin/phpstan analyse -c ./phpstan.neon ./web/profiles/contrib/localgov/ ./web/modules/contrib/localgov_* ./web/themes/contrib/localgov_*"
if [ $? -ne 0 ]; then
((RESULT++))
fi
# PHPUnit tests.
echo "Running tests"
docker exec -t drupal bash -c "mkdir -p /var/www/html/web/sites/simpletest && chmod 777 /var/www/html/web/sites/simpletest"
# Older versions of Paratest (the one required by LocalGov 1.x) don't pickup
# environmental variables, so it's necessary to change the config file directly.
docker exec -u docker -t drupal bash -c 'sed -i "s#http://localgov.lndo.site#http://drupal#" /var/www/html/phpunit.xml.dist'
docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4"
if [ $? -ne 0 ]; then
((RESULT++))
fi
# Set return code depending on number of tests that failed.
exit $RESULT