当前位置: 首页>>代码示例>>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;未经允许,请勿转载。