public function ParagraphsPackTestCase::testParagraphsPackFieldFileCreation in Paragraphs pack 7
Test function for field file creation.
File
- tests/
paragraphs_pack.test, line 353 - Paragraphs pack primary module's tests.
Class
- ParagraphsPackTestCase
- Test Case for Paragraphs pack primary module.
Code
public function testParagraphsPackFieldFileCreation() {
$uri_scheme = 'public';
// Run tested function.
$field = paragraphs_pack_get_field_file($uri_scheme);
// 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_FILE);
$this
->assertEqual($field_info['type'], 'file');
$this
->assertEqual($field_info['entity_types'], array(
PP_PARAGRAPH_TYPE,
));
$this
->assertEqual($field_info['cardinality'], -1);
$this
->assertEqual($field_info['settings']['uri_scheme'], $uri_scheme);
}
}