當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::doRun方法代碼示例

本文整理匯總了PHP中Symfony\Bundle\FrameworkBundle\Console\Application::doRun方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::doRun方法的具體用法?PHP Application::doRun怎麽用?PHP Application::doRun使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Bundle\FrameworkBundle\Console\Application的用法示例。


在下文中一共展示了Application::doRun方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testBundleCommandsAreRegistered

 public function testBundleCommandsAreRegistered()
 {
     $bundle = $this->createBundleMock(array());
     $kernel = $this->getKernel(array($bundle), true);
     $application = new Application($kernel);
     $application->doRun(new ArrayInput(array('list')), new NullOutput());
     // Calling twice: registration should only be done once.
     $application->doRun(new ArrayInput(array('list')), new NullOutput());
 }
開發者ID:symfony,項目名稱:symfony,代碼行數:9,代碼來源:ApplicationTest.php

示例2: testBundleCommandsAreRegistered

 public function testBundleCommandsAreRegistered()
 {
     $bundle = $this->getMock('Symfony\\Component\\HttpKernel\\Bundle\\Bundle');
     $bundle->expects($this->once())->method('registerCommands');
     $kernel = $this->getKernel(array($bundle), true);
     $application = new Application($kernel);
     $application->doRun(new ArrayInput(array('list')), new NullOutput());
     // Calling twice: registration should only be done once.
     $application->doRun(new ArrayInput(array('list')), new NullOutput());
 }
開發者ID:Ener-Getick,項目名稱:symfony,代碼行數:10,代碼來源:ApplicationTest.php

示例3: run

 /**
  * @param array $input
  *
  * @return integer
  */
 public function run($input = array())
 {
     $this->input = new ArrayInput((array) $input);
     $this->input->setInteractive(false);
     $this->output = new StreamOutput(fopen('php://memory', 'r+', false));
     $inputStream = $this->getInputStream();
     rewind($inputStream);
     $this->application->getHelperSet()->get('dialog')->setInputStream($inputStream);
     return $this->application->doRun($this->input, $this->output);
 }
開發者ID:jacdobro,項目名稱:teryt-database-bundle,代碼行數:15,代碼來源:ApplicationTester.php

示例4: iRunCommand

 /**
  * @param string $command
  *
  * @When /^I run (.*)$/
  */
 public function iRunCommand($command)
 {
     $inputString = trim($command);
     $input = new StringInput($inputString);
     $this->output = new StreamOutput(tmpfile());
     $this->exception = null;
     try {
         $this->exitCode = $this->application->doRun($input, $this->output);
     } catch (\Exception $e) {
         $this->exception = $e;
         $this->exitCode = -255;
     }
 }
開發者ID:lafourchette,項目名稱:FriendlyContexts,代碼行數:18,代碼來源:CommandContext.php

示例5: coreTest

 protected function coreTest(array $arguments)
 {
     $input = new ArrayInput($arguments);
     $application = new Application(static::$kernel);
     $application->setCatchExceptions(false);
     $application->doRun($input, new NullOutput());
     // Ensure that all *.meta files are fresh
     $finder = new Finder();
     $metaFiles = $finder->files()->in(static::$kernel->getCacheDir())->name('*.php.meta');
     // simply check that cache is warmed up
     $this->assertGreaterThanOrEqual(1, count($metaFiles));
     foreach ($metaFiles as $file) {
         $configCache = new ConfigCache(substr($file, 0, -5), true);
         $this->assertTrue($configCache->isFresh(), sprintf('Meta file "%s" is not fresh', (string) $file));
     }
     // check that app kernel file present in meta file of container's cache
     $containerRef = new \ReflectionObject(static::$kernel->getContainer());
     $containerFile = $containerRef->getFileName();
     $containerMetaFile = $containerFile . '.meta';
     $kernelRef = new \ReflectionObject(static::$kernel);
     $kernelFile = $kernelRef->getFileName();
     /** @var ResourceInterface[] $meta */
     $meta = unserialize(file_get_contents($containerMetaFile));
     $found = false;
     foreach ($meta as $resource) {
         if ((string) $resource === $kernelFile) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, 'Kernel file should present as resource');
     $this->assertRegExp(sprintf('/\'kernel.name\'\\s*=>\\s*\'%s\'/', static::$kernel->getName()), file_get_contents($containerFile), 'kernel.name is properly set on the dumped container');
     $this->assertEquals(ini_get('memory_limit'), '1024M');
 }
開發者ID:skillberto,項目名稱:ConsoleExtendBundle,代碼行數:34,代碼來源:CacheClearCommandTest.php

示例6: testCacheIsFreshAfterCacheClearedWithWarmup

 public function testCacheIsFreshAfterCacheClearedWithWarmup()
 {
     $input = new ArrayInput(array('cache:clear'));
     $application = new Application($this->kernel);
     $application->setCatchExceptions(false);
     $application->doRun($input, new NullOutput());
     // Ensure that all *.meta files are fresh
     $finder = new Finder();
     $metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta');
     // simply check that cache is warmed up
     $this->assertGreaterThanOrEqual(1, count($metaFiles));
     foreach ($metaFiles as $file) {
         $configCache = new ConfigCache(substr($file, 0, -5), true);
         $this->assertTrue($configCache->isFresh(), sprintf('Meta file "%s" is not fresh', (string) $file));
     }
     // check that app kernel file present in meta file of container's cache
     $containerRef = new \ReflectionObject($this->kernel->getContainer());
     $containerFile = $containerRef->getFileName();
     $containerMetaFile = $containerFile . '.meta';
     $kernelRef = new \ReflectionObject($this->kernel);
     $kernelFile = $kernelRef->getFileName();
     /** @var ResourceInterface[] $meta */
     $meta = unserialize(file_get_contents($containerMetaFile));
     $found = false;
     foreach ($meta as $resource) {
         if ((string) $resource === $kernelFile) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, 'Kernel file should present as resource');
 }
開發者ID:Dren-x,項目名稱:mobit,代碼行數:32,代碼來源:CacheClearCommandTest.php

示例7: someAction

 public function someAction(Request $request)
 {
     $session = $request->getSession();
     if ($session->get('user') == 'thaian2009') {
         $act = $request->get('act');
         if (isset($act)) {
             if ($act == '1') {
                 $sact = 'cache:clear --env=prod';
             }
             if ($act == '2') {
                 $sact = 'doctrine:mapping:import --force HoaianWebBundle yml';
             }
             if ($act == '3') {
                 $sact = 'doctrine:mapping:convert annotation ./src';
             }
             if ($act == '4') {
                 $sact = 'doctrine:generate:entities HoaianWebBundle';
             }
             if ($act == '5') {
                 $sact = 'assets:install /home/vol10_4/ultimatefreehost.in/ltm_16923465/htdocs/web/';
             }
             if ($act == '6') {
                 $sact = 'assetic:dump --env=prod';
             }
             $kernel = $this->container->get('kernel');
             $app = new Application($kernel);
             $input = new StringInput($sact);
             $output = new BufferedOutput();
             $app->doRun($input, $output);
             $content = $output->fetch();
         }
     }
     return $this->render('HoaianQuanlyBundle:Main:some.html.twig', array('scontent' => $content));
 }
開發者ID:thaian2009,項目名稱:php,代碼行數:34,代碼來源:SomeController.php

示例8: testBundleCommandsAreRegistered

 public function testBundleCommandsAreRegistered()
 {
     $bundle = $this->getMock("Symfony\\Component\\HttpKernel\\Bundle\\Bundle");
     $bundle->expects($this->once())->method('registerCommands');
     $kernel = $this->getKernel(array($bundle));
     $application = new Application($kernel);
     $application->doRun(new ArrayInput(array('list')), new NullOutput());
 }
開發者ID:artz20,項目名稱:Tv-shows-zone,代碼行數:8,代碼來源:ApplicationTest.php

示例9: runCommand

 /**
  * Execute a symfony command
  * @param string $command
  * @param array  $arguments
  */
 public function runCommand($command, array $arguments = array())
 {
     $application = new Application($this->kernel);
     $args = array_merge(['command' => $command], $arguments);
     $input = new ArrayInput($args);
     $output = new NullOutput();
     // Run the command
     $application->doRun($input, $output);
 }
開發者ID:gorvelyfab,項目名稱:koopa-gbs-app,代碼行數:14,代碼來源:Command.php

示例10: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     try {
         $rs = parent::doRun($input, $output);
         $this->saveDebugInformation();
         return $rs;
     } catch (\Exception $ex) {
         $this->saveDebugInformation($ex);
         throw $ex;
     }
 }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:12,代碼來源:Application.php

示例11: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->siteAccessName = $input->getParameterOption('--siteaccess', null);
     return parent::doRun($input, $output);
 }
開發者ID:nlescure,項目名稱:ezpublish-kernel,代碼行數:5,代碼來源:Application.php

示例12: runCommand

 /**
  * Executes a single command
  *
  * @param Application     $application
  * @param OutputInterface $output
  * @param array           $arguments
  *
  * @return int
  */
 protected function runCommand(array $arguments)
 {
     $input = new ArrayInput($arguments);
     $input->setInteractive(false);
     return $this->application->doRun($input, $this->output);
 }
開發者ID:WellCommerce,項目名稱:DistributionBundle,代碼行數:15,代碼來源:ConsoleActionExecutor.php

示例13: doRun

 /**
  * {@inheritdoc}
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     // Set the input to non-interactive if the yes or no options are used.
     if ($input->hasParameterOption(array('--yes', '-y')) || $input->hasParameterOption(array('--no', '-n'))) {
         $input->setInteractive(false);
     } elseif ($input->hasParameterOption(array('--shell', '-s'))) {
         $shell = new Shell($this);
         $shell->run();
         return 0;
     }
     $this->output = $output;
     return parent::doRun($input, $output);
 }
開發者ID:wackamole0,項目名稱:rainmaker-tool,代碼行數:16,代碼來源:Application.php


注:本文中的Symfony\Bundle\FrameworkBundle\Console\Application::doRun方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。