You are here

protected function FeedsMapperFileTestCase::createContentTypeWithFileField in Feeds 7.2

Creates a content type with a file field.

Parameters

string $dest: The folder to save files to. Leave empty to not set that.

Return value

string The name of the content type that was created.

5 calls to FeedsMapperFileTestCase::createContentTypeWithFileField()
FeedsMapperFileTestCase::testFileExistsRename in tests/feeds_mapper_file.test
Test mapping of local resources with the file exists "Rename" setting.
FeedsMapperFileTestCase::testFileExistsRenameIfDifferent in tests/feeds_mapper_file.test
Test mapping of local resources with the file exists "Rename if different" setting.
FeedsMapperFileTestCase::testFileExistsReplace in tests/feeds_mapper_file.test
Test mapping of local resources with the file exists "Replace" setting.
FeedsMapperFileTestCase::testFileExistsReplaceIfDifferent in tests/feeds_mapper_file.test
Test mapping of local resources with the file exists "Replace if different" setting.
FeedsMapperFileTestCase::testFileExistsSkip in tests/feeds_mapper_file.test
Test mapping of local resources with the file exists "Skip existig" setting.

File

tests/feeds_mapper_file.test, line 889
Contains FeedsMapperFileTestCase.

Class

FeedsMapperFileTestCase
Test case for Filefield mapper mappers/filefield.inc.

Code

protected function createContentTypeWithFileField($dest = '') {
  $typename = $this
    ->createContentType(array(), array(
    'files' => array(
      'type' => 'file',
      'instance_settings' => array(
        'instance[settings][file_extensions]' => 'png, gif, jpg, jpeg',
      ),
    ),
  ));

  // Set a destination folder, if given.
  if ($dest) {
    $edit = array(
      'instance[settings][file_directory]' => $dest,
    );
    $this
      ->drupalPost('admin/structure/types/manage/' . $typename . '/fields/field_files', $edit, t('Save settings'));
  }
  return $typename;
}