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


PHP Application::all方法代码示例

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


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

示例1: testBundleCommandsAreRetrievable

 public function testBundleCommandsAreRetrievable()
 {
     $bundle = $this->createBundleMock(array());
     $kernel = $this->getKernel(array($bundle));
     $application = new Application($kernel);
     $application->all();
     // Calling twice: registration should only be done once.
     $application->all();
 }
开发者ID:symfony,项目名称:symfony,代码行数:9,代码来源:ApplicationTest.php

示例2: testBundleCommandsAreRetrievable

 public function testBundleCommandsAreRetrievable()
 {
     $bundle = $this->getMock('Symfony\\Component\\HttpKernel\\Bundle\\Bundle');
     $bundle->expects($this->once())->method('registerCommands');
     $kernel = $this->getKernel(array($bundle));
     $application = new Application($kernel);
     $application->all();
     // Calling twice: registration should only be done once.
     $application->all();
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:10,代码来源:ApplicationTest.php

示例3: commandHelper

 /**
  * @param $commandName
  * @param string $kernelName
  * @return CommandHelper
  */
 protected static function commandHelper($commandName, $kernelName = 'default')
 {
     $application = new Application($kernel = static::getSharedKernel($kernelName));
     $container = $kernel->getContainer();
     foreach ($application->all() as $command) {
         if ($command instanceof ContainerAwareInterface) {
             $command->setContainer($container);
         }
     }
     $application->setDispatcher($container->get('event_dispatcher'));
     return new CommandHelper($container, $application->find($commandName));
 }
开发者ID:mpoiriert,项目名称:draw-test-helper-bundle,代码行数:17,代码来源:ServiceTestCaseTrait.php

示例4: execCommand

 /**
  * Execute a symfony command.
  *
  * $this->executeCommand('sulu:security:user:create', array(
  *     'firstName' => 'foo',
  *     '--option' => 'bar',
  * ));
  *
  * @param string $command Command to execute
  * @param array  $args    Arguments and options
  *
  * @return int Exit code of command
  */
 protected function execCommand($command, $args)
 {
     $kernel = $this->kernel;
     array_unshift($args, $command);
     $input = new ArrayInput($args);
     $application = new Application($kernel);
     $application->all();
     $application->setAutoExit(false);
     $application->setCatchExceptions(false);
     $command = $application->find($command);
     $output = new StreamOutput(fopen('php://memory', 'w', false));
     $exitCode = $application->run($input, $output);
     if ($exitCode !== 0) {
         rewind($output->getStream());
         $output = stream_get_contents($output->getStream());
         throw new \Exception(sprintf('Command in BaseContext exited with code "%s": "%s"', $exitCode, $output));
     }
     return $exitCode;
 }
开发者ID:sulu,项目名称:sulu,代码行数:32,代码来源:BaseContext.php

示例5: consoleAction

 public function consoleAction()
 {
     return new Response($this->templating->render('CoreSphereConsoleBundle:Console:console.html.twig', ['working_dir' => getcwd(), 'environment' => $this->environment, 'commands' => $this->application->all()]));
 }
开发者ID:raphydev,项目名称:onep,代码行数:4,代码来源:ConsoleController.php


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