You are here

public function SophronApiTest::testGetMappingErrors in Sophron 8

@covers ::getMapClass @covers ::getMappingErrors

File

tests/src/Kernel/SophronApiTest.php, line 72

Class

SophronApiTest
Tests for Sophron API.

Namespace

Drupal\Tests\sophron\Kernel

Code

public function testGetMappingErrors() : void {
  $config = \Drupal::configFactory()
    ->getEditable('sophron.settings');
  $config
    ->set('map_option', MimeMapManagerInterface::DEFAULT_MAP)
    ->set('map_commands', [
    [
      'aaa',
      [
        'paramA',
        'paramB',
      ],
    ],
    [
      'bbb',
      [
        'paramC',
        'paramD',
      ],
    ],
    [
      'ccc',
      [
        'paramE',
      ],
    ],
    [
      'ddd',
      [],
    ],
  ])
    ->save();
  $manager = \Drupal::service('sophron.mime_map.manager');
  $this
    ->assertSame(DefaultMap::class, $manager
    ->getMapClass());
  $this
    ->assertCount(4, $manager
    ->getMappingErrors(DefaultMap::class));
}