/**
  * @param string $modelClassName
  * @param string $workflowType
  * @return array
  */
 public static function getTypeValuesAndLabels($modelClassName, $workflowType)
 {
     assert('is_string($modelClassName)');
     assert('is_string($workflowType)');
     $data = array();
     $data[static::TYPE_DYNAMIC_TRIGGERED_MODEL_USER] = DynamicTriggeredModelUserWorkflowEmailMessageRecipientForm::getTypeLabel();
     $data[static::TYPE_DYNAMIC_TRIGGERED_MODEL_RELATION_USER] = DynamicTriggeredModelRelationUserWorkflowEmailMessageRecipientForm::getTypeLabel();
     $data[static::TYPE_STATIC_ROLE] = StaticRoleWorkflowEmailMessageRecipientForm::getTypeLabel();
     $data[static::TYPE_DYNAMIC_TRIGGERED_BY_USER] = DynamicTriggeredByUserWorkflowEmailMessageRecipientForm::getTypeLabel();
     $data[static::TYPE_STATIC_USER] = StaticUserWorkflowEmailMessageRecipientForm::getTypeLabel();
     $data[static::TYPE_STATIC_ADDRESS] = StaticAddressWorkflowEmailMessageRecipientForm::getTypeLabel();
     $data[static::TYPE_STATIC_GROUP] = StaticGroupWorkflowEmailMessageRecipientForm::getTypeLabel();
     if (is_subclass_of($modelClassName, 'Contact') || $modelClassName == 'Contact') {
         $data[static::TYPE_DYNAMIC_TRIGGERED_MODEL] = DynamicTriggeredModelWorkflowEmailMessageRecipientForm::getTypeLabel();
     }
     $form = new DynamicTriggeredModelRelationWorkflowEmailMessageRecipientForm($modelClassName, $workflowType);
     $relationValuesAndLabels = $form->getRelationValuesAndLabels();
     if (!empty($relationValuesAndLabels)) {
         $data[static::TYPE_DYNAMIC_TRIGGERED_MODEL_RELATION] = DynamicTriggeredModelRelationWorkflowEmailMessageRecipientForm::getTypeLabel();
     }
     return $data;
 }
 public function testMakeRecipientsForDynamicTriggeredModelRelation()
 {
     $form = new DynamicTriggeredModelRelationWorkflowEmailMessageRecipientForm('Account', Workflow::TYPE_ON_SAVE);
     $form->relation = 'contacts';
     $model = new Account();
     $model->name = 'the account';
     $contact = new Contact();
     $contact->firstName = 'Jason';
     $contact->lastName = 'Blue';
     $contact->state = ContactsUtil::getStartingState();
     $contact->primaryEmail->emailAddress = '*****@*****.**';
     $this->assertTrue($contact->save());
     $contact2 = new Contact();
     $contact2->firstName = 'Laura';
     $contact2->lastName = 'Blue';
     $contact2->state = ContactsUtil::getStartingState();
     $contact2->primaryEmail->emailAddress = '*****@*****.**';
     $this->assertTrue($contact2->save());
     $model->contacts->add($contact);
     $model->contacts->add($contact2);
     $this->assertTrue($model->save());
     $recipients = $form->makeRecipients($model, User::getById(self::$bobbyUserId));
     $this->assertEquals(2, count($recipients));
     $this->assertEquals('Jason Blue', $recipients[0]->toName);
     $this->assertEquals('*****@*****.**', $recipients[0]->toAddress);
     $this->assertEquals($contact->id, $recipients[0]->personsOrAccounts[0]->id);
     $this->assertEquals('Laura Blue', $recipients[1]->toName);
     $this->assertEquals('*****@*****.**', $recipients[1]->toAddress);
     $this->assertEquals($contact2->id, $recipients[1]->personsOrAccounts[0]->id);
 }