title: Fake $_SERVER variables in phpUnit
body: <p>I'm still new to phpUnit and I can't make my (very simple) test work. </p>
  
  <pre><code>&lt;?php
  
  use PHPUnit\Framework\TestCase;
  
  class userTest extends TestCase {
      public function testTrue() {
          $this-&gt;assertTrue(true);
  
          //  This line wont work without autloader.php
          $user = new User();
      }
  }
  </code></pre>
  
  <p>The problem is that I need to load all my classes from autoloader.php:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;phpunit bootstrap="inc/autoload.php"&gt;&lt;/phpunit&gt;
  </code></pre>
  
  <p>But I'n those classes I have a lot of $SERVER variables, like</p>
  
  <pre><code>$_SERVER['REMOTE_ADDR']
  $_SERVER['HTTPS']
  $_SERVER['SERVER_NAME']
  $_SERVER['DOCUMENT_ROOT']
  $_SERVER['REQUEST_URI']
  </code></pre>
  
  <p>This is the error I get:</p>
  
  <pre><code>Notice: Undefined index: REMOTE_ADDR in /Applications/MAMP/htdocs/sakkadentrainer/classes/App.php on line 674
  </code></pre>
  
  <p>How can I make those variables work? I would prefer to kind of "fake" them as env.variables from the phpunit.xml file, but I don't know if that's possible.</p>
  
  <p>Thanks for you help!</p>
  
  <p>My Setup:
      php 7.1.2, phpUnit 6.1.1, macOs Mojave, MAMP</p>
  
  <p><strong>SOLUTION</strong>:
  <a href="https://phpunit.de/manual/6.5/en/appendixes.configuration.html#appendixes.configuration.php-ini-constants-variables" rel="nofollow noreferrer">https://phpunit.de/manual/6.5/en/appendixes.configuration.html#appendixes.configuration.php-ini-constants-variables</a></p>