From 8a6b79ed988bfe4759e6934ca0fff01dda03bf95 Mon Sep 17 00:00:00 2001 From: Alexander Varwijk Date: Fri, 23 Jun 2023 13:43:10 +0200 Subject: [PATCH] Ensure the mail-spool directory exists for Behat tests We previously created this in the GitHub workflow, but this makes new developer project set-up more difficult (because then when running an email test the folder doesn't exist). By adding it to the repository we ensure it's present for developers and we can remove some steps from the CI. We rename it from `swiftmailer-spool` to `mail-spool` because we know in the future we want to move away from swiftmailer. We ignore all messages in the director to make sure we don't accidentally commit debug output. --- .github/workflows/behat.yml | 14 -------------- tests/behat/features/bootstrap/EmailContext.php | 2 +- tests/behat/mail-spool/.gitignore | 1 + 3 files changed, 2 insertions(+), 15 deletions(-) create mode 100644 tests/behat/mail-spool/.gitignore diff --git a/.github/workflows/behat.yml b/.github/workflows/behat.yml index b343d6cbc9f..bf78990da6d 100644 --- a/.github/workflows/behat.yml +++ b/.github/workflows/behat.yml @@ -108,13 +108,6 @@ jobs: drush site-install -y social --db-url=mysql://root:root@db:3306/social $OPTIONAL install_configure_form.update_status_module='array(FALSE,FALSE)' --site-name='Open Social'; - # Create swiftmailer-spool directory for behat tests - if [[ ! -d /var/www/html/profiles/contrib/social/tests/behat/features/swiftmailer-spool ]]; then - mkdir /var/www/html/profiles/contrib/social/tests/behat/features/swiftmailer-spool - fi - chown -R www-data:www-data /var/www/html/profiles/contrib/social/tests/behat/features/swiftmailer-spool - chmod +w -R /var/www/html/profiles/contrib/social/tests/behat/features/swiftmailer-spool - # Make sure swiftmailer is configured for our CI. drush cset -y swiftmailer.transport transport 'smtp' drush cset -y swiftmailer.transport smtp_host 'mailcatcher' @@ -235,13 +228,6 @@ jobs: drush site-install -y social --db-url=mysql://root:root@db:3306/social $OPTIONAL install_configure_form.update_status_module='array(FALSE,FALSE)' --site-name='Open Social'; - # Create swiftmailer-spool directory for behat tests - if [[ ! -d /var/www/html/profiles/contrib/social/tests/behat/features/swiftmailer-spool ]]; then - mkdir /var/www/html/profiles/contrib/social/tests/behat/features/swiftmailer-spool - fi - chown -R www-data:www-data /var/www/html/profiles/contrib/social/tests/behat/features/swiftmailer-spool - chmod +w -R /var/www/html/profiles/contrib/social/tests/behat/features/swiftmailer-spool - # Make sure swiftmailer is configured for our CI. drush cset -y swiftmailer.transport transport 'smtp' drush cset -y swiftmailer.transport smtp_host 'mailcatcher' diff --git a/tests/behat/features/bootstrap/EmailContext.php b/tests/behat/features/bootstrap/EmailContext.php index 15c7b738004..283a1b43e96 100644 --- a/tests/behat/features/bootstrap/EmailContext.php +++ b/tests/behat/features/bootstrap/EmailContext.php @@ -84,7 +84,7 @@ public function getEmailContent($file) { * The path where the spooled emails are stored. */ protected function getSpoolDir() { - $path = \Drupal::service('extension.list.profile')->getPath('social') . '/tests/behat/features/swiftmailer-spool'; + $path = \Drupal::service('extension.list.profile')->getPath('social') . '/tests/behat/mail-spool'; if (!file_exists($path)) { mkdir($path, 0777, true); } diff --git a/tests/behat/mail-spool/.gitignore b/tests/behat/mail-spool/.gitignore new file mode 100644 index 00000000000..843ff5d1a08 --- /dev/null +++ b/tests/behat/mail-spool/.gitignore @@ -0,0 +1 @@ +*.message