title: Symfony - console commands unreachable when running unit tests
body: <p>I'm trying to run a fixture command from php code while running my phpunit tests.
  It ends up in the following error:
  <code>Symfony\\Component\\Console\\Exception\\CommandNotFoundException] There are no commands defined in the \u0022doctrine:fixtures</code></p>
  
  <p>I must say that I've been running the same stuff on my controller and it worked perfectly. Not only cannot it find the <code>doctrine:fixtures</code> command but also all the others.</p>
  
  <p>It is as if all commands were unreachable while running tests.</p>
  
  <p>This is my code:</p>
  
  <pre><code>namespace tests\functional\User\ManagerBundle\Controller;    
  
  use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  use Symfony\Component\HttpFoundation\JsonResponse;
  use Symfony\Component\Console\Input\ArrayInput;
  use Symfony\Component\Console\Application;
  use Symfony\Component\Console\Output\BufferedOutput;
  
  class ClassControllerTest extends WebTestCase
  {
     protected function setUp()
     {
          $client = static::createClient();
  
          $application = new Application($client-&gt;getKernel());
          $application-&gt;setAutoExit(false);
  
          $input = new ArrayInput(array(
              'command' =&gt; 'doctrine:fixtures:load',
              // (optional) define the value of command arguments
  //            'fooArgument' =&gt; 'barValue',
              // (optional) pass options to the command
              '--no-interaction' =&gt; true,
              '--env' =&gt; 'TEST'
          ));
  
          // You can use NullOutput() if you don't need the output
          $output = new BufferedOutput();
          $application-&gt;run($input, $output);
  
          // return the output, don't use if you used NullOutput()
          $content = $output-&gt;fetch();
  
          var_dump(new JsonResponse($content));
  
     }
  }
  </code></pre>