title: Why PHPunit asks for KERNEL_DIR using Silex?
body: <p>I'm trying to setup unit tests for my Silex application but I keep getting this error message:</p>
  
  <blockquote>
    <p>RuntimeException: Either set KERNEL_DIR in your phpunit.xml according to <a href="http://symfony.com/doc/current/book/testing.html#your-first-functional-test" rel="noreferrer">http://symfony.com/doc/current/book/testing.html#your-first-functional-test</a> or override the WebTestCase::createKernel() method.</p>
  </blockquote>
  
  <p>This is my <code>./app/phpunit.xml.dist</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html --&gt;
  &lt;phpunit
      backupGlobals="false"
      backupStaticAttributes="false"
      colors="true"
      convertErrorsToExceptions="true"
      convertNoticesToExceptions="true"
      convertWarningsToExceptions="true"
      processIsolation="false"
      stopOnFailure="false"
      syntaxCheck="false"
      bootstrap="phpunit_bootstrap.php"
  &gt;
      &lt;testsuites&gt;
          &lt;testsuite name="Project Test Suite"&gt;
              &lt;directory&gt;../src/Acme/*/Tests&lt;/directory&gt;
          &lt;/testsuite&gt;
      &lt;/testsuites&gt;
  
      &lt;!--&lt;php&gt;--&gt;
          &lt;!--&lt;server name="KERNEL_DIR" value="/var/www/acme/api/app/" /&gt;--&gt;
      &lt;!--&lt;/php&gt;--&gt;
  &lt;/phpunit&gt;
  </code></pre>
  
  <p>This is my <code>./app/phpunit_bootstrap.php</code> (that include composer's autoloader):</p>
  
  <pre><code>&lt;?php
  
  if (!@include __DIR__ . '/../../vendor/autoload.php') {
      die(&lt;&lt;&lt;'EOT'
  You must set up the project dependencies, run the following commands:
  wget http://getcomposer.org/composer.phar
  php composer.phar install
  EOT
      );
  }
  </code></pre>
  
  <p>My directory structure is the following:</p>
  
  <p><img src="https://i.stack.imgur.com/V3YzF.png" alt="Silex application tree structure"></p>
  
  <p>It looks like <code>phpunit</code> is looking for <code>*Kernel.php</code> but I don't know why.</p>
  
  <p>Here is my unit test:</p>
  
  <pre><code>&lt;?php
  
  namespace Acme\User\Tests\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  
  class UserControllerTest extends WebTestCase
  {
      protected $headers;
  
      protected function setUp()
      {
          $this-&gt;headers = array(
              'CONTENT_TYPE' =&gt; 'application/json',
          );
      }
  
      public function testAuthUser()
      {
          $client = static::createClient();
  
          $client-&gt;request('POST', ...);
  
          // Check the response content type
          $this-&gt;assertTrue(
              $client-&gt;getResponse()-&gt;headers-&gt;contains(
                  'Content-Type',
                  'application/json'
              )
          );
  
          // Assert that the response status code is 2xx
          $this-&gt;assertTrue($client-&gt;getResponse()-&gt;isSuccessful());
  
          $response = json_decode($client-&gt;getResponse()-&gt;getContent(), true);
  
          var_dump($response);die;
      }
  }
  </code></pre>