LoginSignup
6
4

More than 5 years have passed since last update.

phpunitで環境変数を設定する

Posted at

phpunit.xml.dist

<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true" bootstrap="./bootstrap.php" >
    <php>
        <!-- 環境変数の設定 -->
       <env name="TEST_ENV" value="true" />
    </php>
</phpunit>

こうすると、

var_dump(getenv('TEST_ENV'));

とかで値が取れるようになって、テスト or テスト以外の設定変更がちょっとやりやすくなる。

というか、マニュアルに普通に書いてあるのでマニュアル読みましょう的な。。。

6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4