Skip to content

Commit

Permalink
Ensure the mail-spool directory exists for Behat tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Kingdutch committed Jun 23, 2023
1 parent 0c3135c commit 8a6b79e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/features/bootstrap/EmailContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions tests/behat/mail-spool/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.message

0 comments on commit 8a6b79e

Please sign in to comment.