/** * @expectedException RuntimeException * @expectedExceptionMessage Could not generate private key * @covers ImboCli\Command\GeneratePrivateKey::execute */ public function testFailsWhenItCantGenerateAPrivateKey() { $this->command->maxTries = 0; $commandTester = new CommandTester($this->command); $commandTester->execute(array('command' => $this->command->getName())); }
/** * Ask the user for a private key (or generate one if user does not specify) * * @param InputInterface $input * @param OutputInterface $output * @return string */ private function askForPrivateKey(InputInterface $input, OutputInterface $output) { $privateKeyGenerator = new GeneratePrivateKey(); $question = new Question('What do you want the private key to be (leave blank to generate)', $privateKeyGenerator->generate()); return $this->getHelper('question')->ask($input, $output, $question); }