You are here

function ParagraphsPackWebTestCase::check_field_existence in Paragraphs pack 7

Check if the field base and its instance exist.

Parameters

string $field_name: A name of the field.

string $field_bundle: The bundle name for the field instance.

5 calls to ParagraphsPackWebTestCase::check_field_existence()
ParagraphsPackContentTestCase::testParagraphsPackContentFieldsExistence in modules/paragraphs_pack_content/tests/paragraphs_pack_content.test
Test fields and instances existence.
ParagraphsPackjuiceboxTestCase::testParagraphsPackjuiceboxFieldsExistence in modules/paragraphs_pack_juicebox/tests/paragraphs_pack_juicebox.test
Test fields and instances existence.
ParagraphsPackNodeListTestCase::testParagraphsPackNodeListFieldsExistence in modules/paragraphs_pack_node_list/tests/paragraphs_pack_node_list.test
Test fields and instances existence.
ParagraphsPackTaxonomyTermListTestCase::testParagraphsPackTaxonomyTermListFieldsExistence in modules/paragraphs_pack_taxonomy_term_list/tests/paragraphs_pack_taxonomy_term_list.test
Test fields and instances existence.
ParagraphsPackUserListTestCase::testParagraphsPackUserListFieldsExistence in modules/paragraphs_pack_user_list/tests/paragraphs_pack_user_list.test
Test fields and instances existence.

File

tests/paragraphs_pack.test_helper.inc, line 37
Paragraphs pack content module's tests.

Class

ParagraphsPackWebTestCase
Class ParagraphsPackWebTestCase

Code

function check_field_existence($field_name, $field_bundle) {
  $field = field_info_field($field_name);
  $this
    ->assertTrue(!empty($field), t('Field "@paragraph_field" exists.', array(
    '@paragraph_field' => $field_name,
  )));
  $instance = field_info_instance(PP_PARAGRAPH_TYPE, $field_name, $field_bundle);
  $this
    ->assertTrue(!empty($instance), t('Paragraph "@paragraph_bundle" bundle contains "@paragraph_field" field instance.', array(
    '@paragraph_bundle' => $field_bundle,
    '@paragraph_field' => $field_name,
  )));
}