You are here

private function MediaTypeTest::createType in D7 Media 7

2 calls to MediaTypeTest::createType()
MediaTypeTest::testCreate in test/media.types.test
Test creating a new type. Basic CRUD.
MediaTypeTest::testOrder in test/media.types.test
Ensures that the weight is respected when types are created.

File

test/media.types.test, line 28
Tests for media types.

Class

MediaTypeTest
Test media type creation and management.

Code

private function createType($overrides) {
  $type = new stdClass();
  $type->name = 'test';
  $type->label = "Test";
  $type->base = TRUE;

  //    $type->view_mode_defaults = array(
  //      'media_preview' => 'styles_file_square_thumbnail',
  //      'media_original' => 'file_default',
  //    );
  $type->type_callback_args = array(
    'match_type' => 'all',
    'mimetypes' => array(
      '/^test/',
    ),
    'extensions' => array(
      'jpg',
      'jpeg',
      'gif',
      'png',
      'tiff',
    ),
    'streams' => array(
      'public',
      'private',
    ),
  );
  foreach ($overrides as $k => $v) {
    $type->{$k} = $v;
  }
  media_type_save($type);
  return $type;
}