protected function getCommand()
 {
     $kernel = WebTestCase::createKernel();
     $application = new Application($kernel);
     $adapter = new SymfonyFinder();
     $application->add(new FindCommand($adapter));
     return $application->find('fsearch:find');
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  *
  * This is overriden to set the default environment to 'rctest'
  */
 protected static function createKernel(array $options = array())
 {
     // default environment is 'rctest'
     if (!isset($options['environment'])) {
         $options['environment'] = 'default.yml';
     }
     return parent::createKernel($options);
 }
 public function runCommand(Client $client, $command)
 {
     $application = new Application(WebTestCase::createKernel());
     $application->setAutoExit(false);
     $fp = tmpfile();
     $input = new StringInput($command);
     $output = new StreamOutput($fp);
     $application->run($input, $output);
     fseek($fp, 0);
     $output = '';
     while (!feof($fp)) {
         $output = fread($fp, 4096);
     }
     fclose($fp);
     return $output;
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 protected static function createKernel(array $options = array())
 {
     global $_SERVER;
     // "MONOLITH_TEST_SUITE" variable can be set by a script which initiates running tests to signal
     // that this is a monolith repository, that is - the repository contains functional tests
     // for different bundles and in scope of one test run there's a chance that many app kernel instances
     // will be instantiated and as result we want to avoid in-memory caching (this is what original
     // "createClient" method actually does). In-memory caching speeds up test run but at the same
     // time might in case of monolithic repositories will lead to re-using of wrong app kernels
     $isMonolithTestSuite = isset($_SERVER['MONOLITH_TEST_SUITE']) && $_SERVER['MONOLITH_TEST_SUITE'];
     if ($isMonolithTestSuite) {
         static::$class = static::getKernelClass();
         return new static::$class(isset($options['environment']) ? $options['environment'] : 'test', isset($options['debug']) ? $options['debug'] : true);
     } else {
         // letting to use runtime-caching
         return parent::createKernel($options);
     }
 }