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