本文整理汇总了PHP中Symfony\Component\Console\Command\Command::setHelperSet方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::setHelperSet方法的具体用法?PHP Command::setHelperSet怎么用?PHP Command::setHelperSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Command\Command
的用法示例。
在下文中一共展示了Command::setHelperSet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: simulateHelperSet
public function simulateHelperSet(Command $command)
{
$this->dialog = $this->getMock("Symfony\\Component\\Console\\Helper\\DialogHelper");
$helpers = array('dialog' => $this->dialog);
$helperSet = new HelperSet($helpers);
$command->setHelperSet($helperSet);
}
示例2: executeCommand
protected static function executeCommand(Command $command, $siteDir)
{
if (!is_dir($siteDir)) {
throw new \RuntimeException('The meinhof-site-dir (' . $siteDir . ') specified in composer.json was not found in ' . getcwd());
}
$helpers = new HelperSet(array(new FormatterHelper(), new DialogHelper()));
$command->setHelperSet($helpers);
$input = new ArrayInput(array('dir' => $siteDir));
$output = new ConsoleOutput();
$command->run($input, $output);
}
示例3: setHelperSet
/**
* {@inheritdoc}
*/
public function setHelperSet(HelperSet $helperSet)
{
$this->decoratedCommand->setHelperSet($helperSet);
}
示例4: testCommandWithWrongInputsNumber
/**
* @expectedException \RuntimeException
* @expectedMessage Aborted
*/
public function testCommandWithWrongInputsNumber()
{
$questions = array('What\'s your name?', 'How are you?', 'Where do you come from?');
$command = new Command('foo');
$command->setHelperSet(new HelperSet(array(new QuestionHelper())));
$command->setCode(function ($input, $output) use($questions, $command) {
$helper = $command->getHelper('question');
$helper->ask($input, $output, new Question($questions[0]));
$helper->ask($input, $output, new Question($questions[1]));
$helper->ask($input, $output, new Question($questions[2]));
});
$tester = new CommandTester($command);
$tester->setInputs(array('Bobby', 'Fine'));
$tester->execute(array());
}
示例5: setHelperSet
public function setHelperSet(HelperSet $helperSet)
{
parent::setHelperSet($helperSet);
$this->innerCommand->setHelperSet($helperSet);
}
示例6: runDoctrineCommand
/**
* Adds options to a symfony command
*
* @param SymfonyCommand $command
* @param array $opt
* @param array $validOpts
* @param array $arg
*/
protected function runDoctrineCommand(SymfonyCommand $command, array $opt = [], array $validOpts = [], array $arg = [])
{
$helperSet = $this->getEntityManagerHelperSet();
$command->setHelperSet($helperSet);
$command = $this->taskSymfonyCommand($command);
foreach ($opt as $key => $value) {
if (!in_array($key, $validOpts)) {
continue;
}
$command->opt($key, $value);
}
foreach ($arg as $key => $value) {
$command->arg($key, $value);
}
$command->run();
}