/**
  * Set up test
  */
 public function setUp()
 {
     static::$kernel = static::createKernel();
     static::$kernel->boot();
     static::$application = new Application(static::$kernel);
     static::$application->setAutoExit(false);
 }
 protected function setUp()
 {
     $kernel = new TestKernel('test', true);
     $kernel->boot();
     $this->application = new Application($kernel);
     // Without this, the application will call the PHP exit() function
     $this->application->setAutoExit(false);
 }
 protected function setUp()
 {
     self::bootKernel();
     $this->application = new Application(self::$kernel);
     $this->application->setAutoExit(false);
     $this->runConsole("doctrine:schema:drop", ["--force" => true]);
     $this->runConsole("doctrine:schema:create");
 }
Exemple #4
0
 public function setUp()
 {
     $this->client = $this->createClient();
     $this->app = new Application($this->client->getKernel());
     $this->app->setAutoExit(false);
     $this->em = static::$kernel->getContainer()->get('doctrine')->getManager();
     $this->router = static::$kernel->getContainer()->get('router');
 }
 protected function setUp()
 {
     $this->bootKernel();
     $this->application = new Application(self::$kernel);
     $this->application->setAutoExit(false);
     $this->runCommand('doctrine:schema:drop --force');
     $this->runCommand('doctrine:schema:create');
 }
Exemple #6
0
 /**
  * @return Application
  */
 protected function getApplication()
 {
     if (!$this->application) {
         $this->application = new Application($this->get('kernel'));
         $this->application->setAutoExit(false);
     }
     return $this->application;
 }
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel();
     $this->container = static::$kernel->getContainer();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
 }
Exemple #8
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->io = new SymfonyStyle($input, $output);
     $this->container = $this->getContainer();
     $this->apiViews = $this->container->get('ojs_api.twig.api_extension')->getApiViews();
     $this->kernel = $this->container->get('kernel');
     $this->application = new Application($this->kernel);
     $this->application->setAutoExit(false);
 }
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel();
     $this->container = static::$kernel->getContainer();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
     $this->function_exists = $this->getFunctionMock('Abc\\ProcessControl', 'function_exists');
 }
 private static function runCommand($commandName, $options = array())
 {
     $options["-e"] = self::$kernel->getEnvironment();
     $options['command'] = $commandName;
     $input = new ArrayInput($options);
     $output = new NullOutput();
     static::$application->setAutoExit(false);
     self::$application->run($input, $output);
 }
 /**
  * @return App
  */
 protected static function getApplication()
 {
     if (null === self::$application) {
         $client = static::createClient();
         self::$application = new App($client->getKernel());
         self::$application->setAutoExit(false);
     }
     return self::$application;
 }
 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->logger = $this->getMock('Symfony\\Bridge\\Monolog\\Logger', ['log'], ['name' => 'console.chain']);
     $kernel = new \AppKernel('test', false);
     $this->application = new Application($kernel);
     $this->application->setAutoExit(false);
     $kernel->boot();
     $kernel->getContainer()->set('chain_command.logger', $this->logger);
 }
 /**
  * @before
  */
 public function setupSubject()
 {
     $this->supervisorManager = $this->getMockBuilder('YZ\\SupervisorBundle\\Manager\\SupervisorManager')->disableOriginalConstructor()->getMock();
     self::bootKernel();
     static::$kernel->getContainer()->set('supervisor.manager', $this->supervisorManager);
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
 }
 protected static function getApplication()
 {
     if (null === self::$application) {
         $client = static::createClient();
         self::$application = new \Symfony\Bundle\FrameworkBundle\Console\Application($client->getKernel());
         self::$application->setAutoExit(false);
     }
     return self::$application;
 }
 /**
  * @return Application
  */
 private static function getApplication()
 {
     if (null === self::$application) {
         self::$client = static::createClient();
         self::$application = new Application(self::$kernel);
         self::$application->setAutoExit(false);
     }
     return self::$application;
 }
 /**
  * Construct a test case.
  */
 public function __construct()
 {
     parent::__construct();
     self::$kernel = new \AppKernel('test', true);
     self::$kernel->boot();
     self::$application = new Application(self::$kernel);
     self::$application->setAutoExit(false);
     self::$container = self::$kernel->getContainer();
     self::$doctrine = $this->get('doctrine');
 }
 public function setUp()
 {
     parent::setUp();
     $this->client = static::createClient();
     $this->application = new Application($this->client->getKernel());
     $this->application->setAutoExit(false);
     $this->executeCommand(new CreateDatabaseDoctrineCommand(), new ArrayInput([]));
     $this->executeCommand(new MigrationsMigrateDoctrineCommand(), new ArrayInput([]));
     $this->executeCommand(new LoadDataFixturesDoctrineCommand(), new ArrayInput([]));
 }
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel();
     $this->container = static::$kernel->getContainer();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
     $this->metadataFactory = $this->container->get('abc.job.metadata_factory');
     /** @var ClassMetadata $classMetadata */
     $this->classMetadata = $this->metadataFactory->getMetadataForClass(AnnotatedJob::class)->getRootClassMetadata();
 }
 protected function setUp()
 {
     self::bootKernel();
     $this->application = new Application(self::$kernel);
     // Register doctrine bundles
     $this->application->add(new LoadDataFixturesCommand($this->application->getKernel()->getContainer()->get('doctrine'), $this->application->getKernel()->getContainer()->get('hautelook_alice.fixtures.loader'), $this->application->getKernel()->getContainer()->get('hautelook_alice.doctrine.finder')));
     $this->doctrineManager = $this->application->getKernel()->getContainer()->get('doctrine')->getManager();
     $this->application->setAutoExit(false);
     $this->runConsole("doctrine:schema:drop", ["--force" => true]);
     $this->runConsole("doctrine:schema:create");
 }
 /**
  * Setup
  */
 public function setUp()
 {
     static::$kernel = static::createKernel();
     static::$kernel->boot();
     static::$application = new Application(static::$kernel);
     static::$application->setAutoExit(false);
     $this->client = static::createClient();
     static::$application->run(new ArrayInput(array('command' => 'doctrine:database:drop', '--no-interaction' => true, '--force' => true, '--quiet' => true)));
     static::$application->run(new ArrayInput(array('command' => 'doctrine:database:create', '--no-interaction' => true, '--quiet' => true)));
     static::$application->run(new ArrayInput(array('command' => 'doctrine:schema:create', '--no-interaction' => true, '--quiet' => true)));
 }
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     self::bootKernel();
     $this->em = static::$kernel->getContainer()->get('doctrine')->getManager();
     $this->container = static::$kernel->getContainer();
     $this->application = new Application(static::$kernel);
     $this->application->setAutoExit(false);
     $this->application->setCatchExceptions(false);
     $this->runConsole("doctrine:schema:drop", array("--force" => true));
     $this->runConsole("doctrine:schema:update", array("--force" => true));
 }
 protected function setUp()
 {
     $this->initClient();
     $this->loadFixtures(['Oro\\Bundle\\UserBundle\\Tests\\Functional\\DataFixtures\\LoadCommandUserCreateUpdateData']);
     $this->application = new Application($this->client->getKernel());
     $this->application->setAutoExit(false);
     $this->application->add(new CreateUserCommand());
     $this->application->add(new UpdateUserCommand());
     $this->businessUnits = ['bu1' => $this->getReference('bu1')];
     $this->organizations = ['org1' => $this->getReference('org1'), 'org2' => $this->getReference('org2'), 'org3' => $this->getReference('org3')];
     $this->userManager = $this->getContainer()->get('oro_user.manager');
 }
 /**
  * Set up
  */
 public function setUp()
 {
     try {
         $this->client = self::$_client = parent::createClient($this->getKernelOptions(), $this->getServerParameters());
         static::$application = new Application(static::$kernel);
         static::$application->setAutoExit(false);
         $this->container = static::$kernel->getContainer();
     } catch (Exception $e) {
         throw new RuntimeException(sprintf('Unable to start the application: %s', get_class($e) . ':' . $e->getMessage()));
     }
     $this->createSchema();
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var KernelInterface $kernel */
     $kernel = $this->getContainer()->get('kernel');
     $app = new Application($kernel);
     $app->setAutoExit(false);
     $commands = [['command' => 'doctrine:database:drop', '--force' => true, '--if-exists' => true], ['command' => 'doctrine:database:create'], ['command' => 'doctrine:schema:create'], ['command' => 'doctrine:fixtures:load', '--no-interaction' => true, '--fixtures' => 'src/AppBundle/Doctrine/DataFixtures/ORM']];
     foreach ($commands as $command) {
         $app->run(new ArrayInput($command));
     }
     $app->setAutoExit(true);
     return 0;
 }
Exemple #25
0
 /**
  * Set up before class.
  *
  * @throws RuntimeException unable to start the application
  */
 public static function setUpBeforeClass()
 {
     try {
         static::$kernel = static::createKernel();
         static::$kernel->boot();
         static::$application = new Application(static::$kernel);
         static::$application->setAutoExit(false);
         static::$container = static::$kernel->getContainer();
     } catch (Exception $e) {
         throw new RuntimeException(sprintf('Unable to start the application: %s', $e->getMessage()), $e->getCode(), $e);
     }
     static::createSchema();
 }
 /**
  * Sets up the kernel.
  *
  * @return void
  */
 protected function setUpKernel()
 {
     if (null !== $this->kernel) {
         $this->tearDownKernel();
     }
     $this->kernel = $this->createKernel(array('environment' => 'test', 'debug' => true));
     $this->kernel->boot();
     // Create Application
     $this->application = new Application($this->kernel);
     $this->application->setAutoExit(false);
     // Reset database and load fixtures
     $this->runConsole("doctrine:schema:drop", array("--force" => true));
     $this->runConsole("doctrine:schema:create");
     $this->runConsole("doctrine:fixtures:load", array("--no-interaction" => true));
 }
Exemple #27
0
 /**
  * Set up
  */
 public function setUp()
 {
     gc_collect_cycles();
     try {
         static::$kernel = static::createKernel();
         static::$kernel->boot();
         static::$application = new Application(static::$kernel);
         static::$application->setAutoExit(false);
         $this->container = static::$kernel->getContainer();
     } catch (\Exception $e) {
         echo $e->getMessage();
         die;
     }
     $this->createSchema();
 }
 protected function runCommand($command)
 {
     $command = sprintf('%s --quiet', $command);
     $application = new Application($this->client->getKernel());
     $application->setAutoExit(false);
     return $application->run(new StringInput($command));
 }
 private static function initDatabase()
 {
     $console = new Application(static::$kernel);
     $console->setAutoExit(false);
     /**
      * SQLite is not supported yet
      *
      * @link https://github.com/doctrine/dbal/pull/2402
      */
     $commands = ['doctrine:database:create' => ['--if-not-exists' => true], 'doctrine:schema:drop' => ['--full-database' => true, '--force' => true], 'doctrine:migrations:migrate' => [], 'doctrine:fixtures:load' => []];
     foreach ($commands as $command => $args) {
         /** apply common commands options */
         $args['--env'] = 'test';
         $args['--quiet'] = true;
         $args['--no-interaction'] = true;
         $args['command'] = $command;
         try {
             $console->setCatchExceptions(false);
             $console->run(new ArrayInput($args));
         } catch (\Exception $e) {
             echo PHP_EOL . $e->getMessage() . PHP_EOL;
             echo PHP_EOL . $e->getTraceAsString() . PHP_EOL;
             throw $e;
         }
     }
 }
Exemple #30
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io = new SymfonyStyle($input, $output);
     $locator = $this->getContainer()->get('campaignchain.core.module.locator');
     $bundles = $locator->getAvailableBundles();
     $selectedBundle = $this->selectBundle($bundles);
     $generateOutput = new BufferedOutput();
     $application = new Application($this->getContainer()->get('kernel'));
     $application->setAutoExit(false);
     $application->run(new ArrayInput(['command' => $this->getDoctrineMigrationsCommand(), '--no-interaction' => true]), $generateOutput);
     preg_match('/Generated new migration class to "(.*)"/', $generateOutput->fetch(), $matches);
     if (count($matches) < 2) {
         //error
         return;
     }
     $pathForMigrationFile = $matches[1];
     preg_match('/Version.*.php/', $pathForMigrationFile, $fileNames);
     if (!count($fileNames)) {
         return;
     }
     $schemaFile = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..';
     $schemaFile .= DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $selectedBundle->getName();
     $schemaFile .= str_replace('/', DIRECTORY_SEPARATOR, $this->getContainer()->getParameter('campaignchain_update.bundle.schema_dir'));
     $schemaFile .= DIRECTORY_SEPARATOR . $fileNames[0];
     $fs = new Filesystem();
     $fs->copy($pathForMigrationFile, $schemaFile);
     $fs->remove($pathForMigrationFile);
     $this->io->success('Generation finished. You can find the file here:');
     $this->io->text($schemaFile);
 }