Skip to content

Commit

Permalink
Zip files dir (#71)
Browse files Browse the repository at this point in the history
* Zip files dir

* Untar

* Cheange dir

* Fix if

* Fix indention

* Increase drush

* increase drush

* Second var

* Backwards compatibility

* Add some docs

* Update install.sh

* revert

Co-authored-by: Christian Fritsch <[email protected]>
  • Loading branch information
chrfritsch and Christian Fritsch authored Jan 3, 2023
1 parent 02801d7 commit ff026e9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 9 additions & 4 deletions lib/stages/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
2 changes: 1 addition & 1 deletion lib/stages/prepare_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ff026e9

Please sign in to comment.