diff --git a/configuration.sh b/configuration.sh index db42a7a..c6685a3 100644 --- a/configuration.sh +++ b/configuration.sh @@ -22,6 +22,9 @@ DRUPAL_TESTING_PROJECT_TYPE=${DRUPAL_TESTING_PROJECT_TYPE:-$(jq -er '.type // "p # Setting this to a filename, creates a dump from an installation, that can be used by all tests, instead of reinstalling # for every test. This is currently supported only by the thunder distribution. +# The behavior differs based on the file extension: +# - .php: Only the database php dump will be created and used. +# - .tar.gz: A tar will be created, that contains the database php dump and the files directory. DRUPAL_TESTING_TEST_DUMP_FILE=${DRUPAL_TESTING_TEST_DUMP_FILE:-""} # The drupal profile that is used in the tests. diff --git a/lib/stages/install.sh b/lib/stages/install.sh index bf0be0f..328b3b4 100644 --- a/lib/stages/install.sh +++ b/lib/stages/install.sh @@ -37,9 +37,14 @@ _stage_install() { fi cd - || exit - if [[ ${DRUPAL_TESTING_TEST_DUMP_FILE} != "" ]]; then - cd "${docroot}" || exit - php core/scripts/db-tools.php dump-database-d8-mysql --database-url "${SIMPLETEST_DB}" >"${docroot}/${DRUPAL_TESTING_TEST_DUMP_FILE}" - cd - || exit + cd "${docroot}" || exit + if [[ ${DRUPAL_TESTING_TEST_DUMP_FILE} == *.php ]]; then + php core/scripts/db-tools.php dump-database-d8-mysql --database-url "${SIMPLETEST_DB}" >"${DRUPAL_TESTING_TEST_DUMP_FILE}" + elif [[ ${DRUPAL_TESTING_TEST_DUMP_FILE} == *.tar.gz ]]; then + php core/scripts/db-tools.php dump-database-d8-mysql --database-url "${SIMPLETEST_DB}" >"sites/default/database-dump.php" + # Gzip sites/default files directory but exclude config_*, php and styles directories. + tar -czf "${DRUPAL_TESTING_TEST_DUMP_FILE}" --exclude='config_*' --exclude='php' --exclude='styles' --directory='sites/default' files database-dump.php fi + cd - || exit + } diff --git a/lib/stages/prepare_build.sh b/lib/stages/prepare_build.sh index 0c24e36..fc602b5 100644 --- a/lib/stages/prepare_build.sh +++ b/lib/stages/prepare_build.sh @@ -35,7 +35,7 @@ _stage_prepare_build() { composer require oomphinc/composer-installers-extender --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" fi - composer require drush/drush:"^11" --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" + composer require drush/drush:"^11.2.0" --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" composer require phpspec/prophecy-phpunit:^2 --dev --no-update --working-dir="${DRUPAL_TESTING_DRUPAL_INSTALLATION_DIRECTORY}" # Require phpstan.