title: Symfony2 command change environment
body: <p>I want to set up an order allowing me to make clear: cache test mode, then do a drop database, drop scheama, add scheme, add fixtures in test mode.</p>
  
  <pre><code>class BaseCommand extends \Symfony\Component\Console\Command\Command {
  
  //put your code here
  
  protected function configure()
  {
      $this
              -&gt;setName('mycommand:test')
              -&gt;setDescription('Launch test')
      ;
  
  }
  
  protected function execute(InputInterface $input, OutputInterface $output)
  {
      $command_first_migration = $this-&gt;getApplication()-&gt;find('cache:clear');
      $arguments_first_migration = array(
          'command' =&gt; 'cache:clean',
          '--env' =&gt; 'test'
      );
      $input_first_migration = new ArrayInput($arguments_first_migration);
      try {
  
          $returnCode = $command_first_migration-&gt;run($input_first_migration, $output);
  
  
      } catch (\Doctrine\DBAL\Migrations\MigrationException $ex) {
          echo "MigrationExcepion !!!! ";
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>but I have this result : </p>
  
  <pre><code>clearing the case for the dev environment with debug true
  </code></pre>
  
  <p>How to pass the test in dev environment?</p>
  
  <p>thank you</p>