For Moodle development I occasionally clone a production environment to a temporary test location. This way I know for certain that my custom code works in the environment it should work in.

The downside of this approach is that notifications are still mailed to users. So after a bit of searching in the Moodle docs I have found no solution. So I went digging in the code, and found a configuration option that prevents the Moodle installation to send emails completely. All you have to do is put the following setting in your config.php.
$CFG->noemailever = true;

Tip: A lot of settings are also described in the config-dist.php file in the root folder of your Moodle installation.