You are here

public function SophronGuesserTest::testGuesserInstallUninstall in Sophron 8

@covers ::guess

File

tests/src/Kernel/SophronGuesserTest.php, line 49

Class

SophronGuesserTest
Tests for Sophron guesser.

Namespace

Drupal\Tests\sophron\Kernel

Code

public function testGuesserInstallUninstall() : void {
  $guesser = \Drupal::service('file.mime_type.guesser.extension');
  $this
    ->assertEquals('application/octet-stream', $guesser
    ->guess('fake.jp2'));
  \Drupal::service('module_installer')
    ->install([
    'sophron_guesser',
  ]);
  $guesser = \Drupal::service('file.mime_type.guesser.extension');
  $this
    ->assertEquals('image/jp2', $guesser
    ->guess('fake.jp2'));
  \Drupal::service('module_installer')
    ->uninstall([
    'sophron_guesser',
  ]);
  $guesser = \Drupal::service('file.mime_type.guesser.extension');
  $this
    ->assertEquals('application/octet-stream', $guesser
    ->guess('fake.jp2'));
}