本文整理汇总了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()]));
}