forked from lecterror/cakephp-filter-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace test script with phpunit script and before and after scripts
- Loading branch information
Showing
4 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env sh | ||
# stop mysql service at the end of the tests | ||
service mysql stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
# the docker image to use for phpunit testing | ||
DOCKER_IMAGE="devkba/cake2-app-template:staging" | ||
# the path to prepend to the test case | ||
TEST_PREFIX="Plugin/Filter/" | ||
# compile PHPUnit parameters | ||
PARAMS="" | ||
for arg in "$@"; do | ||
# add prefix in case an argument is a path to a test | ||
if [[ "${arg}" == *Test.php ]]; then | ||
arg="${TEST_PREFIX}${arg}" | ||
fi | ||
# in case this is the first argument, don't add $IFS | ||
if [ "${PARAMS}" == "" ]; then | ||
PARAMS="${arg}" | ||
else | ||
PARAMS="${PARAMS}${IFS}${arg}" | ||
fi | ||
done | ||
# pull latest docker image | ||
docker pull "${DOCKER_IMAGE}" || exit $? | ||
# run actual PHPUnit inside docker container | ||
docker run \ | ||
--rm \ | ||
--init \ | ||
-it \ | ||
-v "$(pwd)":/cakephp-filter-plugin \ | ||
-e DEBUG=0 \ | ||
-e BEFORE_SCRIPT="/cakephp-filter-plugin/Test/before_script.sh" \ | ||
-e AFTER_SCRIPT="/cakephp-filter-plugin/Test/after_script.sh" \ | ||
"${DOCKER_IMAGE}" vendor/bin/phpunit ${PARAMS} |