当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::run方法代码示例

本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Console\Application::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::run方法的具体用法?PHP Application::run怎么用?PHP Application::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Bundle\FrameworkBundle\Console\Application的用法示例。


在下文中一共展示了Application::run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: command

 public function command($command, $opts = [])
 {
     $opts['-e'] = 'test';
     $opts['-q'] = null;
     $opts['command'] = $command;
     return $this->app->run(new ArrayInput($opts));
 }
开发者ID:hasantayyar,项目名称:ojs,代码行数:7,代码来源:BaseTestCase.php

示例2: runConsole

 /**
  * @param $command
  * @param array $options
  * @return int
  */
 protected function runConsole($command, array $options = array())
 {
     $options["-e"] = "test";
     $options["-q"] = null;
     $options = array_merge($options, array('command' => $command));
     return $this->application->run(new \Symfony\Component\Console\Input\ArrayInput($options));
 }
开发者ID:aboutcoders,项目名称:file-distribution-bundle,代码行数:12,代码来源:FilesystemManagerIntegrationTest.php

示例3: runConsole

 /**
  * Helper to run a Symfony command.
  *
  * @param string $command
  * @param array  $options
  *
  * @return int
  * @throws \Exception
  */
 protected function runConsole($command, array $options = [])
 {
     $options["-e"] = "test";
     $options["-q"] = null;
     $options = array_merge($options, ['command' => $command]);
     return $this->application->run(new ArrayInput($options));
 }
开发者ID:ronanguilloux,项目名称:AliceBundle,代码行数:16,代码来源:CommandTestCase.php

示例4: cleanDB

 /**
  * @BeforeScenario @cleanDB
  * @AfterScenario @cleanDB
  */
 public function cleanDB()
 {
     $application = new Application($this->getKernel());
     $application->setAutoExit(false);
     $application->run(new StringInput("doctrine:schema:drop --force -n -q"));
     $application->run(new StringInput("doctrine:schema:create -n -q"));
 }
开发者ID:tarnawski,项目名称:JSONMock-backend,代码行数:11,代码来源:ApiContext.php

示例5: tearDownAfterClass

 /**
  * Ensure next tests will have a clean database.
  */
 public static function tearDownAfterClass()
 {
     $application = new Application(static::$kernel);
     $application->setAutoExit(false);
     $application->run(new ArrayInput(['command' => 'doctrine:schema:drop', '--no-interaction' => true, '--force' => true, '--env' => 'test']), new NullOutput());
     $application->run(new ArrayInput(['command' => 'doctrine:schema:create', '--no-interaction' => true, '--env' => 'test']), new NullOutput());
     $application->run(new ArrayInput(['command' => 'doctrine:fixtures:load', '--no-interaction' => true, '--env' => 'test']), new NullOutput());
 }
开发者ID:wallabag,项目名称:wallabag,代码行数:11,代码来源:InstallCommandTest.php

示例6: setUp

 protected function setUp()
 {
     $client = static::createClient();
     $application = new Application($client->getKernel());
     $application->setAutoExit(false);
     $application->run(new StringInput('doctrine:database:drop --force'));
     $application->run(new StringInput('doctrine:database:create'));
     $application->run(new StringInput('doctrine:schema:update --force'));
 }
开发者ID:andrejc,项目名称:STMS,代码行数:9,代码来源:SecurityControllerTest.php

示例7: runCommand

 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);
 }
开发者ID:rvanlaarhoven,项目名称:LexikTranslationBundle,代码行数:9,代码来源:ImportTranslationsCommandTest.php

示例8: testExecute

 public function testExecute()
 {
     $kernel = $this->createKernel();
     $kernel->boot();
     $application = new Application($kernel);
     $application->setAutoExit(false);
     $input = new ArgvInput(['', 'doctrine:database:drop', '--no-interaction', '--force', '-q']);
     $application->run($input);
     $input = new ArgvInput(['', 'doctrine:database:create', '--no-interaction', '-q']);
     $application->run($input);
     $input = new ArgvInput(['', 'doctrine:migrations:migrate', '--no-interaction', '-q']);
     $application->run($input);
     $em = $kernel->getContainer()->get('doctrine')->getManager();
     $customer = new Customer();
     $customer->setEmail('example@example.org');
     $customer->setActivationCode('abc');
     $customer->setEmployeeNumber('1234567890');
     $customer->setSalesdivision(Customer::SALESDIVISION_MEDIAMARKT_SATURN);
     $customer->setIsActivated(true);
     $customer->setCouponsHaveBeenSent(false);
     $customer->setOptInAccepted(false);
     $em->persist($customer);
     $couponcode = new Couponcode();
     $couponcode->setCode('111');
     $em->persist($couponcode);
     $couponcode = new Couponcode();
     $couponcode->setCode('222');
     $em->persist($couponcode);
     $couponcode = new Couponcode();
     $couponcode->setCode('333');
     $em->persist($couponcode);
     $couponcode = new Couponcode();
     $couponcode->setCode('444');
     $em->persist($couponcode);
     $couponcode = new Couponcode();
     $couponcode->setCode('555');
     $em->persist($couponcode);
     $couponcode = new Couponcode();
     $couponcode->setCode('666');
     $em->persist($couponcode);
     $em->flush();
     $application->add(new SendCouponsCommand());
     $command = $application->find('app:sendcoupons');
     $commandTester = new CommandTester($command);
     $commandTester->execute(array('command' => $command->getName()));
     $this->assertSame("example@example.org\n", $commandTester->getDisplay());
     $this->assertTrue($customer->getCouponsHaveBeenSent());
     $repo = $em->getRepository('AppBundle\\Entity\\Couponcode');
     $codes = $repo->findBy(['customer' => 1]);
     $this->assertSame('111', $codes[0]->getCode());
     $this->assertSame('222', $codes[1]->getCode());
     $this->assertSame('333', $codes[2]->getCode());
     $this->assertSame('444', $codes[3]->getCode());
     $this->assertSame('555', $codes[4]->getCode());
     $this->assertSame('666', $codes[5]->getCode());
     $this->assertSame(6, sizeof($codes));
 }
开发者ID:Galeria-Kaufhof,项目名称:goodbuy-metro,代码行数:57,代码来源:SendCouponsCommandTest.php

示例9: setUp

 /**
  * 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)));
 }
开发者ID:raizeta,项目名称:ControllerExtraBundle,代码行数:14,代码来源:AbstractWebTestCase.php

示例10: restoreDatabase

 /**
  * @BeforeScenario
  */
 public function restoreDatabase()
 {
     $this->getEntityManager()->getConnection()->executeUpdate("SET foreign_key_checks = 0;");
     $application = new Application($this->kernel);
     $application->setAutoExit(false);
     $drop = array('command' => 'doctrine:schema:drop', '--force' => true, '--no-interaction' => true, '--quiet' => true, '--env' => 'test');
     $this->getEntityManager()->getConnection()->executeUpdate("SET foreign_key_checks = 1;");
     $application->run(new ArrayInput($drop));
     $create = array('command' => 'doctrine:schema:create', '--no-interaction' => true, '--quiet' => true, '--env' => 'test');
     $application->run(new ArrayInput($create));
 }
开发者ID:gobaldia,项目名称:eventator,代码行数:14,代码来源:FeatureContext.php

示例11: setUp

 public function setUp()
 {
     $this->client = static::createClient();
     $this->em = $this->client->getContainer()->get('doctrine')->getManager();
     $application = new Application($this->client->getKernel());
     $application->setAutoExit(false);
     $application->run(new StringInput('doctrine:database:drop --force'));
     $application->run(new StringInput('doctrine:database:create'));
     $application->run(new StringInput('doctrine:schema:update --force'));
     $application->run(new StringInput('doctrine:fixtures:load --append'));
     $this->logIn();
 }
开发者ID:andrejc,项目名称:STMS,代码行数:12,代码来源:TaskControllerTest.php

示例12: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     foreach ($this->apiViews as $apiView) {
         $bufferOutput = new BufferedOutput();
         $this->application->run(new StringInput(sprintf('api:doc:dump --view=%s', $apiView)), $bufferOutput);
         $viewDump = $bufferOutput->fetch();
         $viewDumpFile = __DIR__ . '/../Resources/doc/' . $apiView . '-api-doc.md';
         file_put_contents($viewDumpFile, $viewDump);
         $this->io->writeln(sprintf("%s -> view dumped to %s", $apiView, $viewDumpFile));
     }
 }
开发者ID:ojs,项目名称:ojs,代码行数:17,代码来源:ApiDocsDumpCommand.php

示例13: prepareFixturesOnly

 public function prepareFixturesOnly()
 {
     $application = new Application($this->kernel);
     $application->setAutoExit(false);
     $options = array('command' => 'doctrine:database:drop', '--force' => true);
     $application->run(new ArrayInput($options));
     $options = array('command' => 'doctrine:database:create');
     $application->run(new ArrayInput($options));
     $options = array('command' => 'doctrine:schema:create');
     $application->run(new ArrayInput($options));
     $this->fixturesApplier->applyFixtures();
 }
开发者ID:kutny,项目名称:fixtures-bundle,代码行数:12,代码来源:TestingEnvironmentPreparer.php

示例14: execute

 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $listenerManager = $this->container->get('doctrine_extensions.listener_manager');
     $listenerManager->addAllListeners($this->container->get('doctrine.orm.entity_manager'));
     $purger = new ORMPurger($this->container->get('doctrine.orm.entity_manager'));
     $purger->purge();
     $string_input = new StringInput('yrch:populate');
     $application = new Application($this->application->getKernel());
     $application->setAutoExit(false);
     $application->run($string_input, $output);
     $string_input = new StringInput('doctrine:data:load --append=true');
     $application->run($string_input, $output);
 }
开发者ID:Nenuial,项目名称:Yrch,代码行数:16,代码来源:LoadFixturesCommand.php

示例15: testIntegration

 public function testIntegration()
 {
     $client = static::createClient();
     $application = new Application($client->getKernel());
     $output = new BufferedOutput();
     $application->setAutoExit(false);
     $application->run(new ArgvInput(), $output);
     $this->assertTrue(strpos($output->fetch(), 'Comment from the method') !== false, 'Description of the command is not parse from the comment of the method');
     $arguments = array('this will be ignored', 'test_service:hello', '--name=toto', '--help');
     $application->run(new ArgvInput($arguments), $output);
     $outputString = $output->fetch();
     $this->assertTrue(strpos($outputString, 'The name of the person you want to say hello to') !== false, 'Parsing of param comment is not working');
     $this->assertTrue(strpos($outputString, '--output') === false, 'Output parameter should not be there since it cannot be enter by the user');
 }
开发者ID:mpoiriert,项目名称:nucleus-console-bundle,代码行数:14,代码来源:NucleusConsoleExtensionTest.php


注:本文中的Symfony\Bundle\FrameworkBundle\Console\Application::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。