title: How to connect test database in functional testing?
body: <p>I study functional test in symfony and It was really successful working on it, but I have problem in the database. In my system, I have 2 database, sample database and sample_test database. The sample database is for production and sample_test for testing for functional test. I have empty data in sample_test. In my config_test.yml. </p>
  
  <pre><code>doctrine:
      # ...
      dbal:
          host:     127.0.1.1
          dbname:   sample_test
          user:     root
          password: null
  </code></pre>
  
  <p>If I load my fixture. It successfully added to my sample_test database. When doing a functional test to my code. How can I connect it to my sample_test database? Just like this code</p>
  
  <pre><code>public function testAddPatient(){
  
      $values = array(
          'patient' =&gt; array(
              'company' =&gt; 1,
              'profile' =&gt; array(
                  'firstName' =&gt; 'John',
                  'lastName' =&gt; 'Funtional test',
                  'email' =&gt; 'email123@gmail.com',
                  'gender' =&gt; 1,
                  'address' =&gt; array(
                      'street' =&gt; 'test functional street',
                      'zipCode' =&gt; 122,
                      'city' =&gt; 367,
                      'state' =&gt; 194,
                      'country' =&gt; 235
                  )
              ),
              'medicalProfile' =&gt; array(
                  'policyNumber' =&gt; 11
              )
          )
      );
  
      $this-&gt;client-&gt;request('POST', '/api/v1/patients', $values, array(), array( 'CONTENT_TYPE' =&gt; 'application/json'));
  
      $this-&gt;assertEquals(
          Response::HTTP_OK,
          $this-&gt;client-&gt;getResponse()-&gt;getStatusCode()
      );
  }
  </code></pre>
  
  <p>When I add the patient. It supposed to be added in my sample_test database not in sample database. Did I miss something about the setup of my database or config? This is the last step I have now to finish my project. </p>
  
  <p>when I run the command <code>phpunit</code> it doesn't add to sampte_test database</p>
  
  <p><strong>Additional Info:</strong></p>
  
  <p>This is what happened to my setup
  I copy app_dev.php and convert it to app_test.php. I did some changes on that file. I export the data and structure in sample database and import it to sample_test database. <strong>NOTE:</strong> I edit the redirect_uris in oath_clients table, just replace dev to test. In my webtestcase controller I have this code</p>
  
  <pre><code>public function setUp()
      {
          $this-&gt;client = static::createClient(array(),
              array(
                  'PHP_AUTH_USER' =&gt; self::USERNAME,
                  'PHP_AUTH_PW' =&gt; self::PASSWORD
              ));
  
      }
  </code></pre>
  
  <p>since the username and password is my sample_test database now. When I run phpunit. It works now.</p>