title: Symfony 4 PHPunit no database selected
body: <p>I try to do some tests with Symfony 4 and phpunit 6, but i have an error message :</p>
  
  <blockquote>
    <p>SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected" at
    /var/www/userDemo/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
    line 108 F<br>
    2 / 2 (100%)</p>
  </blockquote>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>namespace App\Tests;
  
  use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  
  class RegistrationControllerTest extends WebTestCase
  {
      public function testSomething()
      {
          $client = static::createClient();
          $crawler = $client-&gt;request('GET', '/');
  
          $this-&gt;assertSame(200, $client-&gt;getResponse()-&gt;getStatusCode());
          $this-&gt;assertSame(0, $crawler-&gt;filter('html:contains("Hello World")')-&gt;count());
      }
  
      public function testCheckPassword(){
          $client = static::createClient();
  
          $crawler = $client-&gt;request(
              'GET',
              '/register'
          );
  
          $form = $crawler-&gt;selectButton('S\'inscrire')-&gt;form();
  
          $form['user[email]'] = 'toto@email.com';
          $form['user[username]'] = 'usernametest';
          $form['user[fullName]'] = 'John Doe';
          $form['user[password][first]'] = 'pass1';
          $form['user[password][second]'] = 'pass2';
  
          $crawler = $client-&gt;submit($form);
  
          //echo $client-&gt;getResponse()-&gt;getContent();
  
  
          $this-&gt;assertEquals(1,
              $crawler-&gt;filter('li:contains("This value is not valid.")')-&gt;count()
          );
  
  
      }
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>My env file :</p>
  
  <blockquote>
    <p>APP_ENV=dev
    APP_SECRET=XXXX
    DATABASE_URL=mysql://root:@127.0.0.1:3306/userdemo</p>
  </blockquote>
  
  <p>This application work well in dev environnement</p>
  
  <p>Thank you !</p>
  
  <p>[EDIT]
  Just add in phpunit.xml.dist</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;env name="DATABASE_URL" value="mysql://root:@127.0.0.1/userDemo" /&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you to @dbrumann</p>