You are here

public function AssetImageHelperTest::testGetMimeTypeFromFileType in Media: Acquia DAM 8

Validate that we can get proper mime types based on a file extension.

File

tests/src/Unit/AssetImageHelperTest.php, line 133

Class

AssetImageHelperTest
Tests integration of the AssetImageHelper service.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function testGetMimeTypeFromFileType() {
  $this
    ->assertArrayEquals([
    'discrete' => 'image',
    'sub' => 'jpg',
  ], $this->assetImageHelper
    ->getMimeTypeFromFileType('jpg'));
  $this
    ->assertArrayEquals([
    'discrete' => 'video',
    'sub' => 'quicktime',
  ], $this->assetImageHelper
    ->getMimeTypeFromFileType('mov'));
  $this
    ->assertArrayEquals([
    'discrete' => 'application',
    'sub' => 'pdf',
  ], $this->assetImageHelper
    ->getMimeTypeFromFileType('pdf'));
  $this
    ->assertFalse($this->assetImageHelper
    ->getMimeTypeFromFileType('abc123'));
}