在单元测试中忽略.env文件

Most of my classes include loading env variables for configuration. When I was coding I thought vlucas/phpdotenv ignored the .env file on testing environments since there is already a conf file like phpunit.xml where you define them.

Is it possible to make dotenv ignore .env when on testing environment?

Testing will use your .env file, but you can override any of its settings in phpunit.xml.

<php>
    <env name="APP_ENV" value="testing"/>
    <env name="CACHE_DRIVER" value="array"/>
    <env name="SESSION_DRIVER" value="array"/>
    <env name="DB_DRIVER" value="sqlite"/>
    <env name="CACHE_HOST" value="localhost"/>
    <env name="SESSION_HOST" value="localhost"/>
</php>