Skip to content

Commit 3e70f8d

Browse files
author
Takashi Matsuo
committed
Merge pull request GoogleCloudPlatform#88 from GoogleCloudPlatform/automatically-run-all-tests
automatically phpunit in any directory containing phpunit.xml
2 parents 279d1a7 + 7f3a5a1 commit 3e70f8d

File tree

1 file changed

+18
-39
lines changed

1 file changed

+18
-39
lines changed

testing/run_test_suite.sh

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,22 @@ if [ "${RUN_CS_FIXER}" = "true" ]; then
2020
./php-cs-fixer fix --dry-run --diff --config-file=.php_cs .
2121
fi
2222

23-
DIRS=(
24-
appengine/standard/cloudsql
25-
appengine/standard/http
26-
appengine/standard/logging
27-
appengine/standard/mailgun
28-
appengine/standard/mailjet
29-
appengine/standard/memcache
30-
appengine/standard/phpmyadmin
31-
appengine/standard/storage
32-
appengine/standard/taskqueue
33-
appengine/standard/users
34-
appengine/wordpress
35-
bigquery/api
36-
compute/logging
37-
datastore
38-
pubsub
39-
storage/api
40-
)
41-
42-
for DIR in "${DIRS[@]}"; do
43-
pushd ${DIR}
44-
composer install
45-
phpunit
46-
if [ -f build/logs/clover.xml ]; then
47-
cp build/logs/clover.xml \
48-
${TEST_BUILD_DIR}/build/logs/clover-${DIR//\//_}.xml
49-
fi
50-
popd
23+
# loop through all directories containing "phpunit.xml" and run them
24+
find * -name phpunit.xml -not -path '*/vendor/*' -exec dirname {} \; | while read DIR
25+
do
26+
pushd ${DIR}
27+
if [ -f "composer.json" ]; then
28+
composer install
29+
fi
30+
if [ "$DIR" = "appengine/standard/modules" ]; then
31+
# tests that needs special envvars
32+
LOCAL_TEST_TARGETS='app.yaml backend.yaml' phpunit
33+
else
34+
phpunit
35+
fi
36+
if [ -f build/logs/clover.xml ]; then
37+
cp build/logs/clover.xml \
38+
${TEST_BUILD_DIR}/build/logs/clover-${DIR//\//_}.xml
39+
fi
40+
popd
5141
done
52-
53-
# run tests that needs special envvars
54-
# run modules API tests
55-
pushd appengine/standard/modules
56-
composer install
57-
env LOCAL_TEST_TARGETS='app.yaml backend.yaml' phpunit
58-
if [ -f build/logs/clover.xml ]; then
59-
cp build/logs/clover.xml \
60-
${TEST_BUILD_DIR}/build/logs/clover-appengine_standard_modules.xml
61-
fi
62-
popd

0 commit comments

Comments
 (0)