You are here

function MessageNotifyNotifierTest::attachRenderedFields in Message Notify 7.2

Helper function to attach rendred fields.

See also

MessageNotifyNotifier::testPostSendRenderedField()

1 call to MessageNotifyNotifierTest::attachRenderedFields()
MessageNotifyNotifierTest::testPostSendRenderedField in ./message_notify.test
Test populating the rednered output to fields.

File

./message_notify.test, line 177

Class

MessageNotifyNotifierTest
Test the Message notifier plugins handling.

Code

function attachRenderedFields() {
  foreach (array(
    'rendered_foo',
    'rendered_bar',
    'rendered_baz',
  ) as $field_name) {
    $field = array(
      'field_name' => $field_name,
      'type' => 'text_long',
      'entity_types' => array(
        'message',
      ),
    );
    $field = field_create_field($field);
    $instance = array(
      'field_name' => $field_name,
      'bundle' => 'foo',
      'entity_type' => 'message',
      'label' => $field_name,
    );
    if ($field_name == 'rendered_baz') {
      $instance['settings'] = array(
        'text_processing' => 1,
      );
    }
    field_create_instance($instance);
  }
}