當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。