You are here

public function ParagraphsPackTestCase::testParagraphsPackFieldTitleCreation in Paragraphs pack 7

Test function for field title creation.

File

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

Class

ParagraphsPackTestCase
Test Case for Paragraphs pack primary module.

Code

public function testParagraphsPackFieldTitleCreation() {

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

  // 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_TITLE);
    $this
      ->assertEqual($field_info['type'], 'text');
    $this
      ->assertEqual($field_info['entity_types'], array(
      PP_PARAGRAPH_TYPE,
    ));
  }
}