diff --git a/configuration.sh b/configuration.sh index d654e48..db42a7a 100644 --- a/configuration.sh +++ b/configuration.sh @@ -38,6 +38,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")} +# Path for phpunit to search for test files. Default is the current project folder. +DRUPAL_TESTING_TEST_PATH=${DRUPAL_TESTING_TEST_PATH:-""} + # The phpunit test group. To provide multiple groups, concatenate them with comma: # E.g. DRUPAL_TESTING_TEST_GROUP="mygroup1,mygroup2" DRUPAL_TESTING_TEST_GROUP=${DRUPAL_TESTING_TEST_GROUP:-""} @@ -46,6 +49,10 @@ DRUPAL_TESTING_TEST_GROUP=${DRUPAL_TESTING_TEST_GROUP:-""} # E.g. DRUPAL_TESTING_TEST_GROUP_EXCLUDE="mygroup1,mygroup2" DRUPAL_TESTING_TEST_GROUP_EXCLUDE=${DRUPAL_TESTING_TEST_GROUP_EXCLUDE:-""} +# The phpunit testsuite. To provide multiple suites, concatenate them with comma: +# E.g. DRUPAL_TESTING_TEST_SUITE="functional,kernel" +DRUPAL_TESTING_TEST_SUITE=${DRUPAL_TESTING_TEST_SUITE:-""} + # Boolean value if coding styles should be tested with burdamagazinorg/thunder-dev-tools. # By default coding styles are tested. DRUPAL_TESTING_TEST_CODING_STYLES=${DRUPAL_TESTING_TEST_CODING_STYLES:-true} diff --git a/lib/stages/run_tests.sh b/lib/stages/run_tests.sh index 7269ec6..427f46d 100644 --- a/lib/stages/run_tests.sh +++ b/lib/stages/run_tests.sh @@ -5,10 +5,10 @@ _stage_run_tests() { local docroot local composer_bin_dir - local project_location + local test_location docroot=$(get_distribution_docroot) composer_bin_dir=$(get_composer_bin_directory) - project_location=$(get_project_location) + test_location=$(get_project_location) local test_selection="" local phpunit=${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}/${composer_bin_dir}/phpunit" --debug" @@ -31,6 +31,15 @@ _stage_run_tests() { test_selection="${test_selection} --exclude-group ${DRUPAL_TESTING_TEST_GROUP_EXCLUDE}" fi + if [[ ${DRUPAL_TESTING_TEST_SUITE} ]]; then + test_selection="${test_selection} --testsuite ${DRUPAL_TESTING_TEST_SUITE}" + test_location="" + fi + + if [[ ${DRUPAL_TESTING_TEST_PATH} ]]; then + test_location="${DRUPAL_TESTING_TEST_PATH}" + fi + if [[ -f ${docroot}/${DRUPAL_TESTING_TEST_DUMP_FILE} ]]; then # Database needs to be initialized, if the run was split into a build and a test run. if [[ -x "$(command -v mysql)" ]]; then @@ -43,7 +52,7 @@ _stage_run_tests() { test_selection="${test_selection} --filter ${DRUPAL_TESTING_TEST_FILTER}" fi - local runtest="php ${phpunit} --verbose --configuration ${docroot}/core ${test_selection} ${project_location}" + local runtest="php ${phpunit} --verbose --configuration ${docroot}/core ${test_selection} ${test_location}" eval "${runtest}" || exit 1 }