moodlehq / moodle-docker

A docker environment for moodle developers
GNU General Public License v3.0
373 stars 244 forks source link

Behat Tests sending mails #197

Closed georgmaisser closed 2 years ago

georgmaisser commented 2 years ago

I am trying to include automatically sent mails in our behat tests.

I have

Still, no mails in mailhog. Any ideas what more I need to do? Thank you!

aspark21 commented 2 years ago

Hi George,

Not really the right place to ask about this but you can ask in the forums - https://moodle.org/course/view.php?id=5#section-3 - or in Dev chat - https://docs.moodle.org/dev/Chat

georgmaisser commented 2 years ago

Hi George,

Not really the right place to ask about this but you can ask in the forums - https://moodle.org/course/view.php?id=5#section-3 - or in Dev chat - https://docs.moodle.org/dev/Chat

Hi, thanks for the reply, but I guess it has something to do with the Moodle-docker setup and the used configuration, so I don't think it would be a question to ask on Moodle.org.

The inclusion of mailhog in this Moodle-docker project is a cool feature and I am asking how to also use it for the behat tests.

scara commented 2 years ago

HI @georgmaisser,

Any ideas what more I need to do? Thank you!

Never try by myself: it looks like you're almost there but cron: the Moodle Docker Toolbox does not run any Moodle cron and I'm not sure your message to be sent by an adhoc task. Did you extend \core\task\adhoc_task in your plug-in? Otherwise, try to hit the web cron.

BTW, maybe https://moodle.org/mod/forum/discuss.php?d=354012#p1428125 could be of help for a different approach.

HTH, Matteo

andrewnicols commented 2 years ago

Hi @georgmaisser ,

This is not an issue with the moodle-docker repository. When running Behat, you must allow configuration for any non-default settings. You need to explicitly allow any setting in the $CFG->behat_extraallowedsettings array as documented in config-dist.php.

I'll warn you that this isn't something we currently recommend - you will also need to write steps to confirm that mails arrived in MailHog (which is likely non-trivial).