/**
  * installCron
  *
  * Install the task as a cron job
  *
  * @param array $options An array of key/value pairs where key is the name of
  *                       the option and the value is the value that was set on
  *                       the command line
  * @access protected
  * @return integer
  */
 protected function installCron($options)
 {
     $scriptOptions = $this->unsetOptions($options, array('install', 'cronpath', 'crontime'));
     $scriptName = $this->scriptPrefix . '_' . $this->namespace . '_' . $this->name;
     $sfTaskCall = 'symfony ' . $this->namespace . ':' . $this->name . optionsHelper::makeOptionsString($scriptOptions, $this->options);
     uCron::custom($scriptName, $options['crontime'], $sfTaskCall, $options['cronpath']);
     return 0;
 }
<?php

include __DIR__ . '/../../../../../test/bootstrap/unit.php';
$t = new lime_test(3, new lime_output_color());
$optionsConfig = array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'etsync'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'exacttarget'), new sfCommandOption('mode', null, sfCommandOption::PARAMETER_REQUIRED, 'The mode in which to operate'), new sfCommandOption('install', null, sfCommandOption::PARAMETER_NONE, 'Install the cron job'), new sfCommandOption('cronpath', null, sfCommandOption::PARAMETER_REQUIRED, 'The cron path', '/etc/cron.d'), new sfCommandOption('crontime', null, sfCommandOption::PARAMETER_REQUIRED, 'The cron time', '*/5 * * * *'));
$options = array('application' => 'app', 'env' => 'dev', 'connection' => 'doctrine', 'mode' => 'incremental', 'install' => true, 'cronpath' => '/etc/cron.d', 'crontime' => '*/5 * * * *');
$expected = ' --application=app --env=dev --connection=doctrine --mode=incremental --install --cronpath=/etc/cron.d --crontime=*/5 * * * *';
$t->is(optionsHelper::makeOptionsString($options, $optionsConfig), $expected);
$options = array('application' => 'app', 'env' => 'dev', 'connection' => 'doctrine', 'mode' => 'incremental', 'install' => false, 'cronpath' => '/etc/cron.d', 'crontime' => '*/5 * * * *');
$expected = ' --application=app --env=dev --connection=doctrine --mode=incremental --cronpath=/etc/cron.d --crontime=*/5 * * * *';
$t->is(optionsHelper::makeOptionsString($options, $optionsConfig), $expected);
$options = array('application' => 'app', 'env' => 'dev', 'connection' => 'doctrine', 'mode' => null, 'install' => false, 'cronpath' => '/etc/cron.d', 'crontime' => '*/5 * * * *');
$expected = ' --application=app --env=dev --connection=doctrine --cronpath=/etc/cron.d --crontime=*/5 * * * *';
$t->is(optionsHelper::makeOptionsString($options, $optionsConfig), $expected);