public function testSoapValue()
 {
     $bv_1 = mock('Tracker_FormElement_Field_List_BindValue');
     $bv_1->setReturnValue('getSoapValue', 'Jenny');
     $bv_2 = mock('Tracker_FormElement_Field_List_BindValue');
     $bv_2->setReturnValue('getSoapValue', 'Bob');
     $bv_3 = mock('Tracker_FormElement_Field_List_BindValue');
     $bv_3->setReturnValue('getSoapValue', 'Rob');
     $bv_4 = mock('Tracker_FormElement_Field_List_BindValue');
     $bv_4->setReturnValue('getSoapValue', 'Anne');
     $value_list = new Tracker_Artifact_ChangesetValue_List(111, $this->field, false, array($bv_1, $bv_2, $bv_3, $bv_4));
     $this->assertEqual($value_list->getSoapValue($this->user), array('bind_value' => array(array('bind_value_id' => '', 'bind_value_label' => "Jenny"), array('bind_value_id' => '', 'bind_value_label' => "Bob"), array('bind_value_id' => '', 'bind_value_label' => "Rob"), array('bind_value_id' => '', 'bind_value_label' => "Anne"))));
 }
 /**
  * Get a recipients list for notifications. This is filled by users fields for example.
  *
  * @param Tracker_Artifact_ChangesetValue_List $changeset_value The changeset
  *
  * @return array
  */
 public function getRecipients(Tracker_Artifact_ChangesetValue_List $changeset_value)
 {
     $recipients = array();
     foreach ($changeset_value->getListValues() as $ugroups_value) {
         $recipients = array_merge($recipients, $ugroups_value->getMembersName());
     }
     return $recipients;
 }
 /**
  * Get the diff between this changeset value and the one passed in param
  *
  * @param Tracker_Artifact_ChangesetValue_List $changeset_value the changeset value to compare
  *
  * @return string The difference between another $changeset_value, false if no differneces
  */
 public function diff($changeset_value, $format = 'html')
 {
     $previous = $changeset_value->getListValues();
     $next = $this->getListValues();
     $changes = false;
     if ($previous != $next) {
         $removed_elements = array_diff($previous, $next);
         $removed_arr = array();
         foreach ($removed_elements as $removed_element) {
             $removed_arr[] = $removed_element->getLabel();
         }
         $removed = implode(', ', $removed_arr);
         $added_elements = array_diff($next, $previous);
         $added_arr = array();
         foreach ($added_elements as $added_element) {
             $added_arr[] = $added_element->getLabel();
         }
         $added = implode(', ', $added_arr);
         if (empty($next)) {
             $changes = ' ' . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'cleared');
         } else {
             if (empty($previous)) {
                 $changes = ' ' . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'set_to') . ' ' . $added;
             } else {
                 if (count($previous) == 1 && count($next) == 1) {
                     $changes = ' ' . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'changed_from') . ' ' . $removed . ' ' . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'to') . ' ' . $added;
                 } else {
                     if ($removed) {
                         $changes = $removed . ' ' . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'removed');
                     }
                     if ($added) {
                         if ($changes) {
                             $changes .= PHP_EOL;
                         }
                         $changes .= $added . ' ' . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'added');
                     }
                 }
             }
         }
     }
     return $changes;
 }
 /**
  * Get a recipients list for notifications. This is filled by users fields for example.
  *
  * @param Tracker_Artifact_ChangesetValue_List $changeset_value The changeset
  *
  * @return array
  */
 public function getRecipients(Tracker_Artifact_ChangesetValue_List $changeset_value)
 {
     $recipients = array();
     foreach ($changeset_value->getListValues() as $user_value) {
         if ($user_value->getId() != 100) {
             $recipients[] = $user_value->getUsername();
         }
     }
     return $recipients;
 }
 /**
  * Get the diff between this changeset value and the one passed in param
  *
  * @param Tracker_Artifact_ChangesetValue_List $changeset_value the changeset value to compare
  * @param PFUser                          $user            The user or null
  *
  * @return string The difference between another $changeset_value, false if no differneces
  */
 public function diff($changeset_value, $format = 'html', PFUser $user = null)
 {
     $previous = $changeset_value->getListValues();
     $next = $this->getListValues();
     if ($previous == $next) {
         return false;
     }
     $removed = $this->getRemoved($previous, $next, $format);
     $added = $this->getAdded($previous, $next, $format);
     return $this->getChangesSentence($previous, $next, $added, $removed);
 }