title: Failure to set APP_ENV to 'testing' for unit testing in Laravel 5.5
body: <p>I am using Laravel 5.5, phpunit 6.5.5 on Homestead-7 (I think).</p>
  
  <p>I am trying this tutorial: <a href="https://laravel-news.com/your-first-laravel-application" rel="nofollow noreferrer">https://laravel-news.com/your-first-laravel-application</a> (And this should tell you a lot about my experience with the framework)</p>
  
  <p>Testing fails (due to <code>TokenMismatchException</code>) and I have managed to track down the root cause to the <code>APP_ENV</code> variable being set to <code>local</code>, although I've tried many ways of setting it to <code>testing</code>.</p>
  
  <p>At the end, what allowed me to overcome the problem was to set the variable like this:</p>
  
  <pre><code>APP_ENV=testing vendor/bin/phpunit
  </code></pre>
  
  <p>Then, the tests completed successfully.</p>
  
  <p>My question is, what am I doing wrong? The above hack is obviously not the best way to do it. There must be a way to properly do this.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Contents of <code>phpunit.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;phpunit backupGlobals="false"
           backupStaticAttributes="false"
           bootstrap="vendor/autoload.php"
           colors="true"
           convertErrorsToExceptions="true"
           convertNoticesToExceptions="true"
           convertWarningsToExceptions="true"
           processIsolation="false"
           stopOnFailure="false"&gt;
      &lt;testsuites&gt;
          &lt;testsuite name="Feature"&gt;
              &lt;directory suffix="Test.php"&gt;./tests/Feature&lt;/directory&gt;
          &lt;/testsuite&gt;
  
          &lt;testsuite name="Unit"&gt;
              &lt;directory suffix="Test.php"&gt;./tests/Unit&lt;/directory&gt;
          &lt;/testsuite&gt;
      &lt;/testsuites&gt;
      &lt;filter&gt;
          &lt;whitelist processUncoveredFilesFromWhitelist="true"&gt;
              &lt;directory suffix=".php"&gt;./app&lt;/directory&gt;
          &lt;/whitelist&gt;
      &lt;/filter&gt;
      &lt;php&gt;
          &lt;env name="APP_ENV" value="testing"/&gt;
          &lt;env name="CACHE_DRIVER" value="array"/&gt;
          &lt;env name="SESSION_DRIVER" value="array"/&gt;
          &lt;env name="QUEUE_DRIVER" value="sync"/&gt;
          &lt;env name="DB_CONNECTION" value="sqlite"/&gt;
          &lt;env name="DB_DATABASE" value=":memory:"/&gt;
      &lt;/php&gt;
  &lt;/phpunit&gt;
  </code></pre>
  
  <p>Thank you in advance for your time.</p>