You are here

public function DocumentBundleTest::testMediaBundleCreationFromModule in D7 Media 8

Tests document media bundle creation from config files.

File

src/Tests/DocumentBundleTest.php, line 64

Class

DocumentBundleTest
Ensures that media bundle for document can be created.

Namespace

Drupal\media\Tests

Code

public function testMediaBundleCreationFromModule() {
  $type_configuration = [
    'source_field' => 'field_document',
  ];
  $field_map = [
    'mime' => 'field_mime_type',
    'size' => 'field_document_size',
  ];
  $this
    ->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.');
  $this
    ->assertEqual($this->testBundle
    ->get('label'), 'Document', 'Correct label detected.');
  $this
    ->assertEqual($this->testBundle
    ->get('description'), 'Use Document for uploading document files such as PDF.', 'Correct description detected.');
  $this
    ->assertEqual($this->testBundle
    ->get('type'), 'document', 'Correct plugin ID detected.');
  $this
    ->assertEqual($this->testBundle
    ->get('type_configuration'), $type_configuration, 'Type configuration correct.');
  $this
    ->assertEqual($this->testBundle
    ->get('field_map'), $field_map, 'Correct field map detected.');
}