You are here

public function ParagraphsPackTestCase::testParagraphsPackFieldBodyCreation in Paragraphs pack 7

Test function for field body creation.

File

tests/paragraphs_pack.test, line 127
Paragraphs pack primary module's tests.

Class

ParagraphsPackTestCase
Test Case for Paragraphs pack primary module.

Code

public function testParagraphsPackFieldBodyCreation() {

  // Run function that's being tested.
  $field = paragraphs_pack_get_field_body();

  // Test field existence.
  $field_exists = !empty($field);
  $this
    ->assertTrue($field_exists, t('Field was created successfully.'));
  $field_info = field_info_field($field['field_name']);
  $field_info_exists = !empty($field_info);
  $this
    ->assertTrue($field_info_exists, t('Field was created successfully.'));

  // Test field settings.
  if ($field_info_exists) {
    $this
      ->assertEqual($field_info['field_name'], PP_FIELD_BODY);
    $this
      ->assertEqual($field_info['type'], 'text_long');
    $this
      ->assertEqual($field_info['entity_types'], array(
      PP_PARAGRAPH_TYPE,
    ));
  }
}