Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to set a custom phpunit.xml #83

Merged
merged 15 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ DRUPAL_TESTING_COMPOSER_NAME=${DRUPAL_TESTING_COMPOSER_NAME:-$(jq -r .name "${DR
# vendor/myproject the project name will be myproject.
DRUPAL_TESTING_PROJECT_NAME=${DRUPAL_TESTING_PROJECT_NAME-$(jq -r --arg FALLBACK "$(echo "${DRUPAL_TESTING_COMPOSER_NAME}" | cut -d '/' -f 2)" '.extra."installer-name" // $FALLBACK' "${DRUPAL_TESTING_PROJECT_BASEDIR}/composer.json")}

# The phpunit configuration file to use. Defaults to docroot/core/phpunit.xml.dist
DRUPAL_TESTING_TEST_CONFIGURATION=${DRUPAL_TESTING_TEST_CONFIGURATION:-""}

# Path for phpunit to search for test files. Default is the current project folder.
DRUPAL_TESTING_TEST_PATH=${DRUPAL_TESTING_TEST_PATH:-""}

Expand Down
14 changes: 12 additions & 2 deletions lib/stages/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ _stage_run_tests() {
test_location=$(get_project_location)

local test_selection=""
local phpunit="composer exec -- phpunit --debug"
local phpunit="composer exec -- phpunit"

if [ "${DRUPAL_TESTING_VERBOSE}" = true ]; then
phpunit="${phpunit} --debug"
fi

if [ "${DRUPAL_TESTING_PARALLEL_TESTING}" = true ]; then
phpunit="composer exec -- paratest -p "${DRUPAL_TESTING_PARALLEL_TESTING_PROCESSES}
Expand Down Expand Up @@ -50,7 +54,13 @@ _stage_run_tests() {
test_selection="${test_selection} --filter ${DRUPAL_TESTING_TEST_FILTER}"
fi

local runtest="${phpunit} --configuration ${docroot}/core ${test_selection} ${test_location}"
if [[ ${DRUPAL_TESTING_TEST_CONFIGURATION} ]]; then
test_selection="${test_selection} --configuration ${DRUPAL_TESTING_TEST_CONFIGURATION}"
else
test_selection="${test_selection} --configuration ${docroot}/core"
fi

local runtest="${phpunit} ${test_selection} ${test_location}"

cd "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" || exit
eval "COMPOSER_PROCESS_TIMEOUT=0 ${runtest}" || exit 1
Expand Down