public function tearDown() { if (null !== $this->kernel) { $this->kernel->shutdown(); } parent::tearDown(); }
public static function setUpBeforeClass() { @unlink(__DIR__ . '/../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); @unlink(__DIR__ . '/../Fixtures/Test/TestBundle/Controller/CarController.php'); @unlink(__DIR__ . '/../Fixtures/Test/TestBundle/Controller/OrderController.php'); $kernel = new \AppKernel('test', true); $app = new Application($kernel); $app->addCommands(array(new GenerateRestControllerCommand())); $kernel->boot(); $command = $app->find('generate:rest:controller'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName(), '--controller' => 'TestTestBundle:Order', '--entity' => 'TestTestBundle:Order', '--mongo' => true), array('interactive' => false)); $kernel->shutdown(); $kernel = new \AppKernel('test', true); $app = new Application($kernel); $app->addCommands(array(new GenerateRestControllerCommand())); $kernel->boot(); $command = $app->find('generate:rest:controller'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName(), '--controller' => 'TestTestBundle:Car', '--entity' => 'TestTestBundle:Car'), array('interactive' => false)); $kernel->shutdown(); @unlink(__DIR__ . '/../app/cache/test/appTestUrlGenerator.php.meta'); @unlink(__DIR__ . '/../app/cache/test/appTestUrlGenerator.php'); @unlink(__DIR__ . '/../app/cache/test/appTestUrlMatcher.php.meta'); @unlink(__DIR__ . '/../app/cache/test/appTestUrlMatcher.php'); }
public function up(Schema $schema) { // this up() migration is autogenerated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); $kernel = new \AppKernel('prod', false); $application = new Application($kernel); $application->setAutoExit(false); $application->run(new ArgvInput(array('', 'sns-migrate'))); $kernel->shutdown(); }
public static function tearDownAfterClass() { parent::tearDownAfterClass(); $kernel = new \AppKernel('test', true); $app = new Application($kernel); $app->addCommands(array(new DropDatabaseDoctrineCommand())); $kernel->boot(); $command = $app->find('doctrine:database:drop'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName(), '--force' => true)); $kernel->shutdown(); }
public static function tearDownAfterClass() { parent::tearDownAfterClass(); $kernel = new \AppKernel('test', true); $app = new Application($kernel); $app->addCommands(array(new DropSchemaDoctrineODMCommand())); $kernel->boot(); $command = $app->find('doctrine:mongodb:schema:drop'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $kernel->shutdown(); }
/** * {@inheritdoc} */ public function shutdown() { if (false === $this->booted) { return; } if (!in_array($this->environment, ['test', 'test_cached'], true)) { parent::shutdown(); return; } $container = $this->container; parent::shutdown(); $this->cleanupContainer($container); }
public function testGenerateController() { @unlink(__DIR__ . '/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); @unlink(__DIR__ . '/../../Fixtures/Test/TestBundle/Controller/OrderController.php'); $kernel = new \AppKernel('test', true); $app = new Application($kernel); $app->add(new GenerateRestControllerCommand()); $kernel->boot(); $command = $app->find('generate:rest:controller'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName(), '--controller' => 'TestTestBundle:Order', '--entity' => 'TestTestBundle:Order', '--mongo' => true), array('interactive' => false)); $kernel->shutdown(); $this->assertTrue(class_exists("\\Test\\TestBundle\\Controller\\OrderController")); $this->assertFileExists(__DIR__ . '/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); @unlink(__DIR__ . '/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); @unlink(__DIR__ . '/../../Fixtures/Test/TestBundle/Controller/OrderController.php'); }
protected function execute(InputInterface $input, OutputInterface $output) { while (true) { /** @var \Doctrine\ORM\EntityManager $em */ $em = $this->getContainer()->get('doctrine.orm.entity_manager'); $payments = $em->getRepository(PaymentRequest::class)->findChargeNeeded(); $foundCount = count($payments); $output->writeln("<comment>Found to charge: {$foundCount}</comment>"); $kernel = new \AppKernel('prod', false); $application = new Application($kernel); $application->setAutoExit(false); foreach ($payments as $payment) { $output->writeln("<comment>Start charging: {$payment->getId()}</comment>"); $application->run(new ArgvInput(array('', 'payment-request:charge', $payment->getId()))); $output->writeln("<comment>Payment {$payment->getId()} has charged</comment>"); } $kernel->shutdown(); $em->clear(); sleep(60); } $output->writeln('Started.'); }
public function tearDown() { $this->kernel->shutdown(); parent::tearDown(); }
public function tearDown() { self::$kernel->shutdown(); }
<?php $loader = (require_once __DIR__ . '/bootstrap.php'); require_once __DIR__ . '/sf2app/app/AppKernel.php'; $kernel = new AppKernel('test', true); $kernel->boot(); $gmc = $kernel->getContainer()->get('supertag_gearman.client'); //$gmc->doBackground('failing.gearman.job', 'workload'); //exit(0); for ($i = 0; $i < 100; $i++) { $gmc->doBackground('failing.gearman.job', 'workload' . $i); if ($i % 10 === 0) { $gmc->doLowBackground('sleepy.gearman.job', 'workload' . $i); } if ($i === 50 || $i === 80) { $gmc->doHighBackground('high.gearman.job', 'workload' . $i); } $gmc->doBackground('normal.gearman.job', 'workload' . $i); } $kernel->shutdown();
public function tearDown() { if (self::$kernel instanceof \AppKernel) { self::$kernel->shutdown(); } }