From 3223b1dbef3fbef9894fea5319d6660e9dd4f415 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 14:24:46 +0100 Subject: [PATCH 01/14] Add upgrade commands --- configuration.sh | 8 ++++++ lib/stage.sh | 6 +++++ lib/stages/do_upgrade.sh | 49 +++++++++++++++++++++++++++++++++ lib/stages/prepare_upgrade.sh | 51 +++++++++++++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 lib/stages/do_upgrade.sh create mode 100644 lib/stages/prepare_upgrade.sh diff --git a/configuration.sh b/configuration.sh index 0684b72..84ca04f 100644 --- a/configuration.sh +++ b/configuration.sh @@ -95,6 +95,14 @@ DRUPAL_TESTING_SITES_DIRECTORY=${DRUPAL_TESTING_SITES_DIRECTORY:-default} # This directory gets removed after successful tests. DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY=${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY:-${DRUPAL_TESTING_TEST_BASE_DIRECTORY}/install} + +# Upgrade testing variables. Must be set. +DRUPAL_TESTING_UPGRADE_VERSION=${DRUPAL_TESTING_UPGRADE_VERSION:-""} +DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION=${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION:-""} +# Upgrade testing variables with defaults. +DRUPAL_TESTING_UPGRADE_DRUSH_VERSION=${DRUPAL_TESTING_UPGRADE_DRUSH_VERSION:-"10.3.6"} +DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY=${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY:-${DRUPAL_TESTING_TEST_BASE_DIRECTORY}/old_install} + # The directory, where the tests are located relative to the docroot. This will default to the project directory. DRUPAL_TESTING_TEST_LOCATION=${DRUPAL_TESTING_TEST_LOCATION:-""} diff --git a/lib/stage.sh b/lib/stage.sh index d9e6e74..fe59347 100755 --- a/lib/stage.sh +++ b/lib/stage.sh @@ -57,6 +57,12 @@ stage_dependency() { prepare_build) dep="requirements" ;; + prepare_upgrade) + dep="requirements" + ;; + do_upgrade) + dep="requirements" + ;; requirements) dep="coding_style" ;; diff --git a/lib/stages/do_upgrade.sh b/lib/stages/do_upgrade.sh new file mode 100644 index 0000000..8f02fe4 --- /dev/null +++ b/lib/stages/do_upgrade.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +_stage_do_upgrade() { + local docroot + docroot=$(get_distribution_docroot false) + + # When we test a full project, all we need is the project files itself. + if [[ ${DRUPAL_TESTING_PROJECT_TYPE} != "drupal-profile" ]]; then + printf "prepare_upgrade is only useful for profiles\n" + exit 1 + fi + + # Add asset-packagist for projects, that require frontend assets + if ! composer_repository_exists "https://asset-packagist.org"; then + composer config extra."installer-types".0 bower-asset --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config extra."installer-types".1 npm-asset --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + jq '.extra."installer-paths"."'"${docroot}"'/libraries/{$name}" += ["type:bower-asset", "type:npm-asset"]' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" >"${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.tmp" + mv "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.tmp" "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" + + composer require oomphinc/composer-installers-extender --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + fi + + composer require phpspec/prophecy-phpunit:^2 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Require phpstan. + if [ "${DRUPAL_TESTING_TEST_DEPRECATION}" = true ]; then + composer require mglaman/phpstan-drupal:^1.1 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer require phpstan/phpstan-deprecation-rules:^1.0 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + fi + + # Paratest. + if [ "${DRUPAL_TESTING_PARALLEL_TESTING}" = true ]; then + composer require brianium/paratest:^6.3 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + fi + + # Set the path repository back to the project under test. + composer config repositories.0 path "${DRUPAL_TESTING_PROJECT_BASEDIR}" --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Use jq to find all dev dependencies of the project and add them to root composer file. + for dev_dependency in $(jq -r '.["require-dev"?] | keys[] as $k | "\($k):\(.[$k])"' "${DRUPAL_TESTING_PROJECT_BASEDIR}"/composer.json); do + composer require "${dev_dependency}" --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + done + + # Use the latest drush. + composer require drush/drush --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + composer update -W +} diff --git a/lib/stages/prepare_upgrade.sh b/lib/stages/prepare_upgrade.sh new file mode 100644 index 0000000..9855c62 --- /dev/null +++ b/lib/stages/prepare_upgrade.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +_stage_prepare_upgrade() { + local docroot + docroot=$(get_distribution_docroot false) + + # When we test a full project, all we need is the project files itself. + if [[ ${DRUPAL_TESTING_PROJECT_TYPE} != "drupal-profile" ]]; then + printf "prepare_upgrade is only useful for profiles\n" + exit 1 + fi + + # Checkout the profile and get the version we want to upgrade from. + copy -R ${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} + git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} checkout ${DRUPAL_TESTING_UPGRADE_VERSION} + + printf "Prepare composer.json\n\n" + + # Build is based on drupal project + composer create-project "${DRUPAL_TESTING_COMPOSER_PROJECT}":"${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION}" "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" --no-interaction --no-install + + composer config "minimum-stability" dev --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config "prefer-stable" true --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Reorder repositories, to make sure, local path is first. + composer config repositories.0 path "${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY}" --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + jq '.repositories[0].options = {}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" | awk 'BEGIN{RS="";getline<"-";print>ARGV[1]}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" + jq '.repositories[0].options.symlink = false' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" | awk 'BEGIN{RS="";getline<"-";print>ARGV[1]}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" + + composer config repositories.1 composer https://asset-packagist.org --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config repositories.2 composer https://packages.drupal.org/8 --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Enable patching + composer require cweagans/composer-patches --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config extra.enable-patching true --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + composer require drush/drush:${DRUSH_VERSION} --prefer-lowest --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Allow required plugins + composer config allow-plugins.cweagans/composer-patches true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.drupal/core-composer-scaffold true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.drupal/core-project-message true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.composer/installers true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.oomphinc/composer-installers-extender true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.phpstan/extension-installer true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Install the lowest versions of everything. + composer install --prefer-lowest --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" +} From 9404bd4d59af69c00d5089331720cf893a734ac4 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 14:30:01 +0100 Subject: [PATCH 02/14] Rename commands --- lib/stage.sh | 4 +-- lib/stages/do_upgrade.sh | 49 ------------------------------- lib/stages/old_install.sh | 51 ++++++++++++++++++++++++++++++++ lib/stages/prepare_upgrade.sh | 55 +++++++++++++++++------------------ 4 files changed, 79 insertions(+), 80 deletions(-) delete mode 100644 lib/stages/do_upgrade.sh create mode 100644 lib/stages/old_install.sh diff --git a/lib/stage.sh b/lib/stage.sh index fe59347..626a6f2 100755 --- a/lib/stage.sh +++ b/lib/stage.sh @@ -57,10 +57,10 @@ stage_dependency() { prepare_build) dep="requirements" ;; - prepare_upgrade) + old_install) dep="requirements" ;; - do_upgrade) + prepare_upgrade) dep="requirements" ;; requirements) diff --git a/lib/stages/do_upgrade.sh b/lib/stages/do_upgrade.sh deleted file mode 100644 index 8f02fe4..0000000 --- a/lib/stages/do_upgrade.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -_stage_do_upgrade() { - local docroot - docroot=$(get_distribution_docroot false) - - # When we test a full project, all we need is the project files itself. - if [[ ${DRUPAL_TESTING_PROJECT_TYPE} != "drupal-profile" ]]; then - printf "prepare_upgrade is only useful for profiles\n" - exit 1 - fi - - # Add asset-packagist for projects, that require frontend assets - if ! composer_repository_exists "https://asset-packagist.org"; then - composer config extra."installer-types".0 bower-asset --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config extra."installer-types".1 npm-asset --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - - jq '.extra."installer-paths"."'"${docroot}"'/libraries/{$name}" += ["type:bower-asset", "type:npm-asset"]' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" >"${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.tmp" - mv "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.tmp" "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" - - composer require oomphinc/composer-installers-extender --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - fi - - composer require phpspec/prophecy-phpunit:^2 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - - # Require phpstan. - if [ "${DRUPAL_TESTING_TEST_DEPRECATION}" = true ]; then - composer require mglaman/phpstan-drupal:^1.1 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer require phpstan/phpstan-deprecation-rules:^1.0 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - fi - - # Paratest. - if [ "${DRUPAL_TESTING_PARALLEL_TESTING}" = true ]; then - composer require brianium/paratest:^6.3 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - fi - - # Set the path repository back to the project under test. - composer config repositories.0 path "${DRUPAL_TESTING_PROJECT_BASEDIR}" --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - - # Use jq to find all dev dependencies of the project and add them to root composer file. - for dev_dependency in $(jq -r '.["require-dev"?] | keys[] as $k | "\($k):\(.[$k])"' "${DRUPAL_TESTING_PROJECT_BASEDIR}"/composer.json); do - composer require "${dev_dependency}" --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - done - - # Use the latest drush. - composer require drush/drush --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - - composer update -W -} diff --git a/lib/stages/old_install.sh b/lib/stages/old_install.sh new file mode 100644 index 0000000..6d94bc1 --- /dev/null +++ b/lib/stages/old_install.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +_stage_old_install() { + local docroot + docroot=$(get_distribution_docroot false) + + # When we test a full project, all we need is the project files itself. + if [[ ${DRUPAL_TESTING_PROJECT_TYPE} != "drupal-profile" ]]; then + printf "prepare_upgrade is only useful for profiles\n" + exit 1 + fi + + # Checkout the profile and get the version we want to upgrade from. + copy -R ${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} + git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} checkout ${DRUPAL_TESTING_UPGRADE_VERSION} + + printf "Prepare composer.json\n\n" + + # Build is based on drupal project + composer create-project "${DRUPAL_TESTING_COMPOSER_PROJECT}":"${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION}" "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" --no-interaction --no-install + + composer config "minimum-stability" dev --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config "prefer-stable" true --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Reorder repositories, to make sure, local path is first. + composer config repositories.0 path "${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY}" --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + jq '.repositories[0].options = {}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" | awk 'BEGIN{RS="";getline<"-";print>ARGV[1]}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" + jq '.repositories[0].options.symlink = false' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" | awk 'BEGIN{RS="";getline<"-";print>ARGV[1]}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" + + composer config repositories.1 composer https://asset-packagist.org --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config repositories.2 composer https://packages.drupal.org/8 --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Enable patching + composer require cweagans/composer-patches --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config extra.enable-patching true --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + composer require drush/drush:${DRUSH_VERSION} --prefer-lowest --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Allow required plugins + composer config allow-plugins.cweagans/composer-patches true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.drupal/core-composer-scaffold true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.drupal/core-project-message true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.composer/installers true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.oomphinc/composer-installers-extender true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config allow-plugins.phpstan/extension-installer true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + # Install the lowest versions of everything. + composer install --prefer-lowest --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" +} diff --git a/lib/stages/prepare_upgrade.sh b/lib/stages/prepare_upgrade.sh index 9855c62..18788b6 100644 --- a/lib/stages/prepare_upgrade.sh +++ b/lib/stages/prepare_upgrade.sh @@ -10,42 +10,39 @@ _stage_prepare_upgrade() { exit 1 fi - # Checkout the profile and get the version we want to upgrade from. - copy -R ${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} - git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} checkout ${DRUPAL_TESTING_UPGRADE_VERSION} + # Add asset-packagist for projects, that require frontend assets + if ! composer_repository_exists "https://asset-packagist.org"; then + composer config extra."installer-types".0 bower-asset --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config extra."installer-types".1 npm-asset --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - printf "Prepare composer.json\n\n" + jq '.extra."installer-paths"."'"${docroot}"'/libraries/{$name}" += ["type:bower-asset", "type:npm-asset"]' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" >"${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.tmp" + mv "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.tmp" "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" - # Build is based on drupal project - composer create-project "${DRUPAL_TESTING_COMPOSER_PROJECT}":"${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION}" "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" --no-interaction --no-install - - composer config "minimum-stability" dev --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config "prefer-stable" true --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer require oomphinc/composer-installers-extender --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + fi - # Reorder repositories, to make sure, local path is first. - composer config repositories.0 path "${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY}" --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer require phpspec/prophecy-phpunit:^2 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - jq '.repositories[0].options = {}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" | awk 'BEGIN{RS="";getline<"-";print>ARGV[1]}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" - jq '.repositories[0].options.symlink = false' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" | awk 'BEGIN{RS="";getline<"-";print>ARGV[1]}' "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}""/composer.json" + # Require phpstan. + if [ "${DRUPAL_TESTING_TEST_DEPRECATION}" = true ]; then + composer require mglaman/phpstan-drupal:^1.1 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer require phpstan/phpstan-deprecation-rules:^1.0 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + fi - composer config repositories.1 composer https://asset-packagist.org --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config repositories.2 composer https://packages.drupal.org/8 --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + # Paratest. + if [ "${DRUPAL_TESTING_PARALLEL_TESTING}" = true ]; then + composer require brianium/paratest:^6.3 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + fi - # Enable patching - composer require cweagans/composer-patches --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config extra.enable-patching true --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + # Set the path repository back to the project under test. + composer config repositories.0 path "${DRUPAL_TESTING_PROJECT_BASEDIR}" --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer require drush/drush:${DRUSH_VERSION} --prefer-lowest --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + # Use jq to find all dev dependencies of the project and add them to root composer file. + for dev_dependency in $(jq -r '.["require-dev"?] | keys[] as $k | "\($k):\(.[$k])"' "${DRUPAL_TESTING_PROJECT_BASEDIR}"/composer.json); do + composer require "${dev_dependency}" --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + done - # Allow required plugins - composer config allow-plugins.cweagans/composer-patches true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config allow-plugins.drupal/core-composer-scaffold true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config allow-plugins.drupal/core-project-message true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config allow-plugins.composer/installers true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config allow-plugins.oomphinc/composer-installers-extender true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer config allow-plugins.phpstan/extension-installer true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + # Use the latest drush. + composer require drush/drush --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - # Install the lowest versions of everything. - composer install --prefer-lowest --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" } From 791d3ae83c097b73eaaab40758b1280c5524e0a0 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 14:32:44 +0100 Subject: [PATCH 03/14] Rename commands pt 2 --- lib/stage.sh | 2 +- lib/stages/{old_install.sh => prepare_old_install.sh} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename lib/stages/{old_install.sh => prepare_old_install.sh} (99%) diff --git a/lib/stage.sh b/lib/stage.sh index 626a6f2..4269072 100755 --- a/lib/stage.sh +++ b/lib/stage.sh @@ -57,7 +57,7 @@ stage_dependency() { prepare_build) dep="requirements" ;; - old_install) + prepare_old_install) dep="requirements" ;; prepare_upgrade) diff --git a/lib/stages/old_install.sh b/lib/stages/prepare_old_install.sh similarity index 99% rename from lib/stages/old_install.sh rename to lib/stages/prepare_old_install.sh index 6d94bc1..f03045e 100644 --- a/lib/stages/old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -_stage_old_install() { +_stage_prepare_old_install() { local docroot docroot=$(get_distribution_docroot false) From b931776bce097d36f5ac114d8c572126da087b71 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 14:42:43 +0100 Subject: [PATCH 04/14] Fix command --- lib/stages/prepare_old_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stages/prepare_old_install.sh b/lib/stages/prepare_old_install.sh index f03045e..0d58af7 100644 --- a/lib/stages/prepare_old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -11,7 +11,7 @@ _stage_prepare_old_install() { fi # Checkout the profile and get the version we want to upgrade from. - copy -R ${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} + cp -R ${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} checkout ${DRUPAL_TESTING_UPGRADE_VERSION} printf "Prepare composer.json\n\n" From 0f33235790fe05cb717f90726b03fc2634a42644 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 14:46:36 +0100 Subject: [PATCH 05/14] Fix command pt 2 --- lib/stages/prepare_old_install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/stages/prepare_old_install.sh b/lib/stages/prepare_old_install.sh index 0d58af7..dcc6027 100644 --- a/lib/stages/prepare_old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -11,7 +11,8 @@ _stage_prepare_old_install() { fi # Checkout the profile and get the version we want to upgrade from. - cp -R ${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} + mkdir -p ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} + cp -R ${DRUPAL_TESTING_PROJECT_BASEDIR} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} checkout ${DRUPAL_TESTING_UPGRADE_VERSION} printf "Prepare composer.json\n\n" From 14cfae233a823792007050946380619d7cceacb5 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 14:54:35 +0100 Subject: [PATCH 06/14] Get the right files --- configuration.sh | 1 + lib/stages/prepare_old_install.sh | 2 +- lib/stages/prepare_upgrade.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configuration.sh b/configuration.sh index 84ca04f..324640a 100644 --- a/configuration.sh +++ b/configuration.sh @@ -99,6 +99,7 @@ DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY=${DRUPAL_TESTING_DRUPAL_INSTALLATIO # Upgrade testing variables. Must be set. DRUPAL_TESTING_UPGRADE_VERSION=${DRUPAL_TESTING_UPGRADE_VERSION:-""} DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION=${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION:-""} +DRUPAL_TESTING_WORKSPACE=${DRUPAL_TESTING_WORKSPACE:-""} # Upgrade testing variables with defaults. DRUPAL_TESTING_UPGRADE_DRUSH_VERSION=${DRUPAL_TESTING_UPGRADE_DRUSH_VERSION:-"10.3.6"} DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY=${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY:-${DRUPAL_TESTING_TEST_BASE_DIRECTORY}/old_install} diff --git a/lib/stages/prepare_old_install.sh b/lib/stages/prepare_old_install.sh index dcc6027..e2a1a1b 100644 --- a/lib/stages/prepare_old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -12,7 +12,7 @@ _stage_prepare_old_install() { # Checkout the profile and get the version we want to upgrade from. mkdir -p ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} - cp -R ${DRUPAL_TESTING_PROJECT_BASEDIR} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} + cp -R ${DRUPAL_TESTING_WORKSPACE} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} checkout ${DRUPAL_TESTING_UPGRADE_VERSION} printf "Prepare composer.json\n\n" diff --git a/lib/stages/prepare_upgrade.sh b/lib/stages/prepare_upgrade.sh index 18788b6..c4fa304 100644 --- a/lib/stages/prepare_upgrade.sh +++ b/lib/stages/prepare_upgrade.sh @@ -35,7 +35,7 @@ _stage_prepare_upgrade() { fi # Set the path repository back to the project under test. - composer config repositories.0 path "${DRUPAL_TESTING_PROJECT_BASEDIR}" --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer config repositories.0 path "${DRUPAL_TESTING_WORKSPACE}" --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" # Use jq to find all dev dependencies of the project and add them to root composer file. for dev_dependency in $(jq -r '.["require-dev"?] | keys[] as $k | "\($k):\(.[$k])"' "${DRUPAL_TESTING_PROJECT_BASEDIR}"/composer.json); do From a1cc228ca0f368954ae8ba4f8bbcaefb2e932f43 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 15:01:21 +0100 Subject: [PATCH 07/14] Workspace fun --- configuration.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration.sh b/configuration.sh index 324640a..27049de 100644 --- a/configuration.sh +++ b/configuration.sh @@ -99,8 +99,8 @@ DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY=${DRUPAL_TESTING_DRUPAL_INSTALLATIO # Upgrade testing variables. Must be set. DRUPAL_TESTING_UPGRADE_VERSION=${DRUPAL_TESTING_UPGRADE_VERSION:-""} DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION=${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION:-""} -DRUPAL_TESTING_WORKSPACE=${DRUPAL_TESTING_WORKSPACE:-""} # Upgrade testing variables with defaults. +DRUPAL_TESTING_WORKSPACE=${DRUPAL_TESTING_WORKSPACE:-${GITHUB_WORKSPACE}} DRUPAL_TESTING_UPGRADE_DRUSH_VERSION=${DRUPAL_TESTING_UPGRADE_DRUSH_VERSION:-"10.3.6"} DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY=${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY:-${DRUPAL_TESTING_TEST_BASE_DIRECTORY}/old_install} From 3015fbf36ed1380a93f97288975e2a5d6507707b Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 15:16:14 +0100 Subject: [PATCH 08/14] Fix file copy --- lib/stages/prepare_old_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stages/prepare_old_install.sh b/lib/stages/prepare_old_install.sh index e2a1a1b..dbc818e 100644 --- a/lib/stages/prepare_old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -12,7 +12,7 @@ _stage_prepare_old_install() { # Checkout the profile and get the version we want to upgrade from. mkdir -p ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} - cp -R ${DRUPAL_TESTING_WORKSPACE} ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} + cp -R ${DRUPAL_TESTING_WORKSPACE}/. ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} checkout ${DRUPAL_TESTING_UPGRADE_VERSION} printf "Prepare composer.json\n\n" From ef58f98d3af5d56da8dcc981d84bc1ba7fad7f10 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 15:36:58 +0100 Subject: [PATCH 09/14] Fixes from tmate session --- lib/stages/prepare_old_install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/stages/prepare_old_install.sh b/lib/stages/prepare_old_install.sh index dbc818e..ff0b442 100644 --- a/lib/stages/prepare_old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -3,6 +3,7 @@ _stage_prepare_old_install() { local docroot docroot=$(get_distribution_docroot false) + COMPOSER_ROOT_VERSION=${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION} # When we test a full project, all we need is the project files itself. if [[ ${DRUPAL_TESTING_PROJECT_TYPE} != "drupal-profile" ]]; then @@ -13,6 +14,7 @@ _stage_prepare_old_install() { # Checkout the profile and get the version we want to upgrade from. mkdir -p ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} cp -R ${DRUPAL_TESTING_WORKSPACE}/. ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} + git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} fetch git -C ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} checkout ${DRUPAL_TESTING_UPGRADE_VERSION} printf "Prepare composer.json\n\n" @@ -36,7 +38,7 @@ _stage_prepare_old_install() { composer require cweagans/composer-patches --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" composer config extra.enable-patching true --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" - composer require drush/drush:${DRUSH_VERSION} --prefer-lowest --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer require drush/drush:${DRUPAL_TESTING_UPGRADE_DRUSH_VERSION} --prefer-lowest --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" # Allow required plugins composer config allow-plugins.cweagans/composer-patches true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" @@ -48,5 +50,5 @@ _stage_prepare_old_install() { composer config allow-plugins.phpstan/extension-installer true --no-plugins --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" # Install the lowest versions of everything. - composer install --prefer-lowest --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer update --prefer-lowest --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" } From 19e918dc5a972091dd26c215cd32eb948c962aa1 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 15:41:44 +0100 Subject: [PATCH 10/14] It is necessary to export the composer root version --- lib/stages/prepare_old_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stages/prepare_old_install.sh b/lib/stages/prepare_old_install.sh index ff0b442..d4ea2ac 100644 --- a/lib/stages/prepare_old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -3,7 +3,7 @@ _stage_prepare_old_install() { local docroot docroot=$(get_distribution_docroot false) - COMPOSER_ROOT_VERSION=${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION} + export COMPOSER_ROOT_VERSION=${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION} # When we test a full project, all we need is the project files itself. if [[ ${DRUPAL_TESTING_PROJECT_TYPE} != "drupal-profile" ]]; then From 6b7f0f186229a1db483a36b1af1075ab58b56cc0 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 15:55:03 +0100 Subject: [PATCH 11/14] Fix stage dependencies --- lib/stage.sh | 2 +- lib/stages/prepare_old_install.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/stage.sh b/lib/stage.sh index 4269072..44cbdd5 100755 --- a/lib/stage.sh +++ b/lib/stage.sh @@ -61,7 +61,7 @@ stage_dependency() { dep="requirements" ;; prepare_upgrade) - dep="requirements" + dep="prepare_old_install" ;; requirements) dep="coding_style" diff --git a/lib/stages/prepare_old_install.sh b/lib/stages/prepare_old_install.sh index d4ea2ac..a4010b7 100644 --- a/lib/stages/prepare_old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -51,4 +51,11 @@ _stage_prepare_old_install() { # Install the lowest versions of everything. composer update --prefer-lowest --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + + if [[ ! -d ${DRUPAL_TESTING_LOCK_FILES_DIRECTORY} ]]; then + mkdir -p "${DRUPAL_TESTING_LOCK_FILES_DIRECTORY}" + fi + + # Fake a prepare build completion so that install can run. + touch "${DRUPAL_TESTING_LOCK_FILES_DIRECTORY}/prepare_build" } From f62e030e715f7b8bede930bf209412c30fc614c6 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 16:42:00 +0100 Subject: [PATCH 12/14] Also need to fake complete the build stage --- lib/stages/prepare_old_install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/stages/prepare_old_install.sh b/lib/stages/prepare_old_install.sh index a4010b7..1f42734 100644 --- a/lib/stages/prepare_old_install.sh +++ b/lib/stages/prepare_old_install.sh @@ -56,6 +56,7 @@ _stage_prepare_old_install() { mkdir -p "${DRUPAL_TESTING_LOCK_FILES_DIRECTORY}" fi - # Fake a prepare build completion so that install can run. + # Fake stage completion so that install can run. + touch "${DRUPAL_TESTING_LOCK_FILES_DIRECTORY}/build" touch "${DRUPAL_TESTING_LOCK_FILES_DIRECTORY}/prepare_build" } From b46749756c1abfc4a4b641d71a0d0fd38fd319d4 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 18:13:31 +0100 Subject: [PATCH 13/14] Document the variables properly --- configuration.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/configuration.sh b/configuration.sh index 27049de..d4e2820 100644 --- a/configuration.sh +++ b/configuration.sh @@ -95,13 +95,20 @@ DRUPAL_TESTING_SITES_DIRECTORY=${DRUPAL_TESTING_SITES_DIRECTORY:-default} # This directory gets removed after successful tests. DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY=${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY:-${DRUPAL_TESTING_TEST_BASE_DIRECTORY}/install} - -# Upgrade testing variables. Must be set. +# The version of the project to upgrade from. DRUPAL_TESTING_UPGRADE_VERSION=${DRUPAL_TESTING_UPGRADE_VERSION:-""} + +# The version of the composer project to upgrade from. DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION=${DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION:-""} -# Upgrade testing variables with defaults. + +# The path to the git checkout under test. DRUPAL_TESTING_WORKSPACE=${DRUPAL_TESTING_WORKSPACE:-${GITHUB_WORKSPACE}} + +# The version of Drush to use prior to upgrading. DRUPAL_TESTING_UPGRADE_DRUSH_VERSION=${DRUPAL_TESTING_UPGRADE_DRUSH_VERSION:-"10.3.6"} + +# The location where the project will be copied to and the version to upgrade +# from will be checkout out here. DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY=${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY:-${DRUPAL_TESTING_TEST_BASE_DIRECTORY}/old_install} # The directory, where the tests are located relative to the docroot. This will default to the project directory. From b4b3984c9c8ef402c66fa329540d8496111b0a19 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 14 May 2024 18:21:56 +0100 Subject: [PATCH 14/14] Add new path to clean up --- lib/clean_up.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/clean_up.sh b/lib/clean_up.sh index d2a0812..b0e87ba 100644 --- a/lib/clean_up.sh +++ b/lib/clean_up.sh @@ -7,6 +7,11 @@ clean_up() { docker rm -f -v "${DRUPAL_TESTING_SELENIUM_DOCKER_NAME}" fi + if [[ -d ${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY} ]]; then + chmod -R u+w "${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY}" + rm -rf "${DRUPAL_TESTING_UPGRADE_DRUPAL_INSTALLATION_DIRECTORY}" + fi + if [[ -d ${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY} ]]; then chmod -R u+w "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" rm -rf "${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}"