Exemplo n.º 1
0
 /**
  * @dataProvider askConfirmationDataProvider
  */
 public function testAskConfirmation($answer)
 {
     $question_helper = $this->prophesize('Symfony\\Component\\Console\\Helper\\QuestionHelper');
     $this->helperSet->get('question')->willReturn($question_helper)->shouldBeCalled();
     $question_helper->ask($this->input->reveal(), $this->output->reveal(), Argument::that(function ($question) use($answer) {
         $default_text = $answer ? 'y' : 'n';
         return $question instanceof ConfirmationQuestion && $question->getQuestion() === '<question>text [' . $default_text . ']?</question> ' && $question->getDefault() === $answer;
     }))->shouldBeCalled();
     $this->io->askConfirmation('text', $answer);
 }
Exemplo n.º 2
0
 /**
  * Returns URL of the working copy.
  *
  * @param string $wc_path Working copy path.
  *
  * @return string
  * @throws RepositoryCommandException When repository command failed to execute.
  */
 public function getWorkingCopyUrl($wc_path)
 {
     if ($this->isUrl($wc_path)) {
         return $this->removeCredentials($wc_path);
     }
     try {
         $wc_url = (string) $this->_getSvnInfoEntry($wc_path, self::SVN_INFO_CACHE_DURATION)->url;
     } catch (RepositoryCommandException $e) {
         if ($e->getCode() == RepositoryCommandException::SVN_ERR_WC_UPGRADE_REQUIRED) {
             $message = explode(PHP_EOL, $e->getMessage());
             $this->_io->writeln(array('', '<error>' . end($message) . '</error>', ''));
             if ($this->_io->askConfirmation('Run "svn upgrade"', false)) {
                 $this->getCommand('upgrade', '{' . $wc_path . '}')->runLive();
                 return $this->getWorkingCopyUrl($wc_path);
             }
         }
         throw $e;
     }
     return $wc_url;
 }