public function ParagraphsPackTestCase::testParagraphsPackFieldViewModeCreation in Paragraphs pack 7
Test function for field view mode creation.
File
- tests/
paragraphs_pack.test, line 284 - Paragraphs pack primary module's tests.
Class
- ParagraphsPackTestCase
- Test Case for Paragraphs pack primary module.
Code
public function testParagraphsPackFieldViewModeCreation() {
// Run tested function.
$field = paragraphs_pack_get_field_view_mode();
// 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_VIEW_MODE);
$this
->assertEqual($field_info['type'], PP_FIELD_TYPE_VIEW_MODE);
$this
->assertEqual($field_info['entity_types'], array(
PP_PARAGRAPH_TYPE,
));
$this
->assertEqual($field_info['cardinality'], 1);
}
}