示例#1
0
 public function testSymfonyStyleCommandWithInputs()
 {
     $questions = array('What\'s your name?', 'How are you?', 'Where do you come from?');
     $command = new Command('foo');
     $command->setCode(function ($input, $output) use($questions, $command) {
         $io = new SymfonyStyle($input, $output);
         $io->ask($questions[0]);
         $io->ask($questions[1]);
         $io->ask($questions[2]);
     });
     $tester = new CommandTester($command);
     $tester->setInputs(array('Bobby', 'Fine', 'France'));
     $tester->execute(array());
     $this->assertEquals(0, $tester->getStatusCode());
 }