本文整理匯總了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();
}
示例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();
}
示例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));
}
示例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;
}
示例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()]));
}