1 file.test protected FileTestHelper::createFileType($overrides = array())

Create file type

Parameters

array $overrides: File settings overrides.

Return value

object: File type object.

File

core/modules/file/tests/file.test, line 135
Tests for file.module.

Class

FileTestHelper
Provides methods specifically for testing File module's field handling.

Code

protected function createFileType($overrides = array()) {
  $type = new stdClass();
  $type->type = 'test';
  $type->name = "Test";
  $type->module = 'file';
  $type->description = '';
  $type->mimetypes = array('image/jpeg', 'image/gif', 'image/png', 'image/tiff');

  foreach ($overrides as $k => $v) {
    $type->$k = $v;
  }

  file_type_save($type);

  file_display_save($type->type, 'default', array(
    'formatter' => 'file_field_file_download_link',
    'settings' => array(
      'file_field_file_download_link' => array(
        'text' => 'Download [file:name]',
      ),
    ),
  ));

  return $type;
}