You are here

protected function FileEntityTestBase::createFileType in File Entity (fieldable files) 8.2

Creates a test file type.

Parameters

array $overrides: (optional) An array of values indexed by FileType property names.

Return value

\Drupal\Core\Entity\EntityInterface|static

2 calls to FileEntityTestBase::createFileType()
FileEntityTypeTest::testCreate in tests/src/Functional/FileEntityTypeTest.php
Test creating a new type. Basic CRUD.
FileEntityTypeTest::testTypeWithCandidates in tests/src/Functional/FileEntityTypeTest.php
Make sure candidates are presented in the case of multiple file types.

File

tests/src/Functional/FileEntityTestBase.php, line 81

Class

FileEntityTestBase
Base class for file entity tests.

Namespace

Drupal\Tests\file_entity\Functional

Code

protected function createFileType($type = array()) {
  $type += array(
    'id' => strtolower($this
      ->randomMachineName()),
    'label' => 'Test',
    'mimetypes' => array(
      'image/jpeg',
      'image/gif',
      'image/png',
      'image/tiff',
    ),
  );
  $entity = FileType::create($type);
  $entity
    ->save();
  return $entity;
}