/**
  * Factory method that create a checkout implementation for the console
  * arguments.
  *
  * @param phpucConsoleArgs $args
  *        The given console arguments.
  *
  * @return phpucCheckoutI
  * @throws phpucErrorException
  *         If the defined version control system is not valid, but this
  *         should never happen.
  */
 public static function createCheckout(phpucConsoleArgs $args)
 {
     switch ($args->getOption('version-control')) {
         case 'git':
             $checkout = new phpucGitCheckout();
             break;
         case 'svn':
             $checkout = new phpucSubversionCheckout();
             break;
         case 'cvs':
             $checkout = new phpucCvsCheckout();
             if ($args->hasOption('module') === false) {
                 throw new phpucErrorException('Missing mandatory CVS option --module.');
             }
             $checkout->module = $args->getOption('module');
             break;
         default:
             throw new phpucErrorException("Unknown checkout type '{$args->getOption('version-control')}'");
     }
     $checkout->url = $args->getOption('version-control-url');
     if ($args->hasOption('username')) {
         $checkout->username = $args->getOption('username');
     }
     if ($args->hasOption('password')) {
         $checkout->password = $args->getOption('password');
     }
     return $checkout;
 }
 /**
  * Tests that {@link phpucConsoleArgs#setOption()} works as expected.
  *
  * @return void
  */
 public function testConsoleArgsSetOption()
 {
     $args = new phpucConsoleArgs('phpuc', array(), array());
     $this->assertFalse($args->hasOption('phpuc'));
     $args->setOption('phpuc', 'phpUnderControl');
     $this->assertTrue($args->hasOption('phpuc'));
     $this->assertEquals('phpUnderControl', $args->getOption('phpuc'));
 }
 /**
  * Returns the configured cruisecontrol installation directory.
  *
  * @return string
  */
 protected function getCruiseControlDirectory()
 {
     return $this->args->getArgument('cc-install-dir');
 }