function MimeTypeMapTest::testAddMapping

Same name and namespace in other branches
  1. main core/tests/Drupal/Tests/Core/File/MimeType/MimeTypeMapTest.php \Drupal\Tests\Core\File\MimeType\MimeTypeMapTest::testAddMapping()

Tests add mapping.

File

core/tests/Drupal/Tests/Core/File/MimeType/MimeTypeMapTest.php, line 35

Class

MimeTypeMapTest
Tests the MIME type mapper to extension.

Namespace

Drupal\Tests\Core\File\MimeType

Code

public function testAddMapping() : void {
  $this->map
    ->addMapping('image/gif', 'gif');
  $this->assertEquals('image/gif', $this->map
    ->getMimeTypeForExtension('gif'));
  $this->map
    ->addMapping('image/jpeg', 'jpeg');
  $this->assertEquals('image/jpeg', $this->map
    ->getMimeTypeForExtension('jpeg'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.