/**
  * tests the rekey function in the ContributionTrackingProcessor.
  */
 function testRekey()
 {
     $start = array('bears' => 'green', 'emus' => 'purple');
     $expected = array('llamas' => 'green', 'emus' => 'purple');
     ContributionTrackingProcessor::rekey($start, 'bears', 'llamas');
     $this->assertEquals($start, $expected, "Rekey is not working as expected.");
 }
 /**
  * Stages the relevent data that will be sent to the gateway
  * @global string $wgContributionTrackingPayPalRecurringIPN URL for paypal
  * recurring donations : Defined in ContributionTracking.php
  * @global string $wgContributionTrackingPayPalIPN URL for paypal recurring
  * donations : Defined in ContributionTracking.php
  * @param array $params Parameters to post to the gateway
  * @return array Staged array
  */
 static function stage_repost($params)
 {
     global $wgContributionTrackingPayPalRecurringIPN, $wgContributionTrackingPayPalIPN;
     //TODO: assert that gateway makes The Sense here.
     //change the posted names to match the db where necessary
     ContributionTrackingProcessor::rekey($params, 'amountGiven', 'amount_given');
     ContributionTrackingProcessor::rekey($params, 'returnto', 'return');
     //booleanize!
     ContributionTrackingProcessor::stage_checkbox($params, 'recurring_paypal');
     //poke our language function with the current parameters - this sets the static var correctly
     $params['language'] = ContributionTrackingProcessor::getLanguage($params);
     if (array_key_exists('recurring_paypal', $params) && $params['recurring_paypal']) {
         $params['notify_url'] = $wgContributionTrackingPayPalRecurringIPN;
         $params['item_name'] = ContributionTrackingProcessor::msg('contrib-tracking-item-name-recurring');
     } else {
         $params['notify_url'] = $wgContributionTrackingPayPalIPN;
         $params['item_name'] = ContributionTrackingProcessor::msg('contrib-tracking-item-name-onetime');
     }
     $repost_params = ContributionTrackingProcessor::mergeArrayDefaults($params, ContributionTrackingProcessor::getRepostDefaults(), true);
     return $repost_params;
 }