setHelperSet() public method

Sets the helper set.
public setHelperSet ( Symfony\Component\Console\Helper\HelperSet $helperSet )
$helperSet Symfony\Component\Console\Helper\HelperSet A HelperSet instance
Example #1
1
 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);
 }
Example #2
0
 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);
 }
 /**
  * {@inheritdoc}
  */
 public function setHelperSet(HelperSet $helperSet)
 {
     $this->decoratedCommand->setHelperSet($helperSet);
 }
Example #4
0
 /**
  * @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());
 }
Example #5
0
 public function setHelperSet(HelperSet $helperSet)
 {
     parent::setHelperSet($helperSet);
     $this->innerCommand->setHelperSet($helperSet);
 }
Example #6
0
 /**
  * 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();
 }