Use different phpunit.xml configuration files for each environment.
.
├── phpunit_test_emails.xml
└── phpunit_other_env.xml
Run the tests with specific configuration:
$ phpunit -c phpunit_test_emails.xml
You can set different PHP configurations in the XML configuration file.
You create a custom bootstrap via the bootstrap attribute where additional initialisations can be done if needed.
<phpunit bootstrap="test/bootstrap.php">
<!-- ... -->
<php>
<includePath>.</includePath>
<ini name="foo" value="bar"/>
<const name="foo" value="bar"/>
<var name="foo" value="bar"/>
<env name="foo" value="bar"/>
<post name="foo" value="bar"/>
<get name="foo" value="bar"/>
<cookie name="foo" value="bar"/>
<server name="foo" value="bar"/>
<files name="foo" value="bar"/>
<request name="foo" value="bar"/>
</php>
</phpunit>
See the PHPUnit Manual for more details.